mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-14 17:14:46 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcad67a1c2 | ||
|
|
1bd3b61df9 | ||
|
|
060ca1eb80 | ||
|
|
98a2d9c65e | ||
|
|
eb010094ca | ||
|
|
e6cbced8a2 | ||
|
|
d300078227 | ||
|
|
65c7f0242c | ||
|
|
c4140ef9c3 | ||
|
|
389e5e01e7 | ||
|
|
a55b2645b7 | ||
|
|
9a36381ce0 | ||
|
|
2565eea5ba | ||
|
|
13ae9ece47 | ||
|
|
d3e87b1aaf | ||
|
|
1e9952e908 | ||
|
|
10678d6469 | ||
|
|
1601136304 | ||
|
|
e1758f63cd | ||
|
|
f46bcf228c | ||
|
|
baa70ece6d | ||
|
|
8977d04de0 | ||
|
|
2a35b05ec1 | ||
|
|
122af6d72d | ||
|
|
9cd3b9af5b | ||
|
|
61704192fe | ||
|
|
a3ae2b797f | ||
|
|
d94a688f28 | ||
|
|
b3fbadce84 | ||
|
|
04d6b979ab | ||
|
|
fae3b3d24e | ||
|
|
98372c3e08 | ||
|
|
0a68dc0307 | ||
|
|
4c72917c05 | ||
|
|
b41646540c | ||
|
|
8dc81b53d6 | ||
|
|
ec111e38c3 | ||
|
|
8edd081de6 | ||
|
|
852604e9d4 | ||
|
|
58a8b29bbf | ||
|
|
0fc61f46b0 | ||
|
|
92d53626ce | ||
|
|
24ca3d20f3 | ||
|
|
080e026285 | ||
|
|
e5979367ee | ||
|
|
960b322e86 | ||
|
|
d536d5cf46 | ||
|
|
3850b1b172 | ||
|
|
7981288250 | ||
|
|
e77f62d8e7 | ||
|
|
5326e41c9f | ||
|
|
f2395d27a8 | ||
|
|
ca9c99c283 | ||
|
|
8cbb94aed0 | ||
|
|
e00d96ff08 | ||
|
|
d436657556 | ||
|
|
f862485a05 | ||
|
|
9af62513e5 | ||
|
|
e8fa5ebca9 | ||
|
|
a9fbfbbe74 | ||
|
|
c54b7c40bb | ||
|
|
2b3b590cf4 | ||
|
|
291fa98639 | ||
|
|
a2938d8e55 | ||
|
|
0d1d8295b4 | ||
|
|
daa3ab13be | ||
|
|
17182cc2b2 | ||
|
|
8f1b1e03f4 | ||
|
|
d55b119019 | ||
|
|
00c444a46d | ||
|
|
e780215100 | ||
|
|
3c5c624251 | ||
|
|
36508a191a | ||
|
|
550462221c | ||
|
|
defbdc8e71 | ||
|
|
6346039f14 | ||
|
|
d32530caba | ||
|
|
f5a73db68d | ||
|
|
e23a38e1f1 | ||
|
|
6763619289 | ||
|
|
d652cd7a9b | ||
|
|
7183d734f0 | ||
|
|
7b93aca1e6 | ||
|
|
bcaaf251c6 | ||
|
|
eefd71ef56 | ||
|
|
f2d315c251 | ||
|
|
e4b8342e1c | ||
|
|
107047a04c | ||
|
|
1430becdff | ||
|
|
77295ab74e | ||
|
|
68f61ab9ab | ||
|
|
1c6d55931d | ||
|
|
8fe121f8b9 | ||
|
|
0fcd151776 | ||
|
|
52994b2a39 | ||
|
|
885fc1291e | ||
|
|
b23167d468 | ||
|
|
6d7f30ea6b | ||
|
|
70d8d76934 | ||
|
|
a449e1b3b2 | ||
|
|
ca64f88113 | ||
|
|
62261a5b8f | ||
|
|
20b2dcf9c3 | ||
|
|
98e62aa1e3 | ||
|
|
a4f7e4c583 | ||
|
|
305be1b979 | ||
|
|
43bd276389 | ||
|
|
eb20049b6d | ||
|
|
4432b0dac4 | ||
|
|
8d5b19787e | ||
|
|
d705f4f4db | ||
|
|
2f6969e141 | ||
|
|
26ff21f446 | ||
|
|
4cfa8f7338 | ||
|
|
e2fff11ea8 | ||
|
|
09df969bcf | ||
|
|
483a21cd7d | ||
|
|
71dcbdf0e4 | ||
|
|
d63377532c | ||
|
|
46348fca07 | ||
|
|
08555326b2 | ||
|
|
90f80da4da | ||
|
|
db0ab5feda | ||
|
|
06549d1e2d | ||
|
|
8406073107 | ||
|
|
e55b21028e | ||
|
|
a1cf0ddf77 | ||
|
|
2d8cadea26 | ||
|
|
4e963ca6e1 | ||
|
|
947717873d | ||
|
|
45f167754a | ||
|
|
35afdc66b8 | ||
|
|
89c3fb8bdf | ||
|
|
c7d88d73d3 | ||
|
|
344bb7514b | ||
|
|
db93c6e930 | ||
|
|
aaa00d0184 | ||
|
|
d4b8c6b503 | ||
|
|
ccdcce47cc | ||
|
|
364ed4cf53 | ||
|
|
84da3cc939 | ||
|
|
344e842764 | ||
|
|
3d4ba15751 | ||
|
|
d8beaa92b9 | ||
|
|
a68cbc54e7 | ||
|
|
a8b7098f39 | ||
|
|
1b741eaac5 | ||
|
|
9cbb6e390b | ||
|
|
c4b3f7e9f1 | ||
|
|
792ab77a48 | ||
|
|
3326f4db03 | ||
|
|
5ea4770a2d | ||
|
|
5c4bd5307c | ||
|
|
2242dfdfb9 | ||
|
|
e26da52d21 | ||
|
|
dbf6202a90 | ||
|
|
1d2266a524 | ||
|
|
a300e97aa0 | ||
|
|
76fe2b1c90 | ||
|
|
099f33549b | ||
|
|
e281cb4591 | ||
|
|
99f09b4037 | ||
|
|
23ffb78ab3 | ||
|
|
2cb1959421 | ||
|
|
7ffb9d5c1d | ||
|
|
029604222c | ||
|
|
c6f205864f | ||
|
|
4cc318bc1d | ||
|
|
c010977a0b | ||
|
|
84e9673454 | ||
|
|
54e4aafc0e | ||
|
|
46256bac41 | ||
|
|
4f48cd5890 | ||
|
|
48d6230ed1 | ||
|
|
f3895aeaab | ||
|
|
4c6a461425 | ||
|
|
f6a166c87f | ||
|
|
8be4298ca9 | ||
|
|
fafee34803 | ||
|
|
4ab3e7ddb4 | ||
|
|
8ff72af9d2 | ||
|
|
b2d722a4c5 | ||
|
|
475d99eae8 | ||
|
|
d0244ece32 | ||
|
|
4f95ceab29 | ||
|
|
0105f36668 | ||
|
|
ab3ba0c4db | ||
|
|
38009bb32a | ||
|
|
d132a0ae62 | ||
|
|
d827a0f132 | ||
|
|
891c0c6133 | ||
|
|
f8a9bf44c3 | ||
|
|
874a49262d | ||
|
|
3636af5b9c | ||
|
|
034cdf2860 |
No files matched your search
@@ -5,6 +5,7 @@
|
||||
!/forestry_techne
|
||||
!/gradle/wrapper
|
||||
!/src
|
||||
!/api
|
||||
|
||||
# files
|
||||
!/.gitignore
|
||||
|
||||
+5
-2
@@ -1,6 +1,9 @@
|
||||
[submodule "lang"]
|
||||
path = lang
|
||||
url = https://github.com/ForestryMC/Forestry-Localization.git
|
||||
[submodule "api"]
|
||||
path = api
|
||||
[submodule "api/redstoneflux"]
|
||||
path = api/redstoneflux
|
||||
url = https://github.com/CoFH/RedstoneFlux-API.git
|
||||
[submodule "api/forestry"]
|
||||
path = api/forestry
|
||||
url = https://github.com/ForestryMC/ForestryAPI.git
|
||||
-1
Submodule api deleted from 2bb45e18be.
Submodule
+1
Submodule api/forestry added at b41c05d38a.
Submodule
+1
Submodule api/redstoneflux added at 10e10af214.
@@ -1,6 +1,6 @@
|
||||
mcversion=1.7.10
|
||||
forgeversion=10.13.0.1207
|
||||
forgeversion=10.13.2.1286
|
||||
version_major=3
|
||||
version_minor=3
|
||||
version_minor=4
|
||||
version_patch=0
|
||||
|
||||
+30
-34
@@ -31,7 +31,9 @@ archivesBaseName = "forestry_" + mcversion
|
||||
|
||||
ext.dirDest = './build/dist'
|
||||
ext.dirLang = "./lang"
|
||||
ext.dirApi = "./api"
|
||||
|
||||
ext.apiForestry = "./api/forestry"
|
||||
ext.apiRedstoneFlux = "./api/redstoneflux"
|
||||
|
||||
ext.CraftGuideRepo = "https://github.com/Uristqwerty/CraftGuide.git"
|
||||
ext.CraftGuideTmp = "build/tmp/CraftGuide"
|
||||
@@ -54,7 +56,8 @@ sourceSets {
|
||||
|
||||
main {
|
||||
java {
|
||||
srcDir project.dirApi
|
||||
srcDir project.apiForestry
|
||||
srcDir project.apiRedstoneFlux + "/src/main/java"
|
||||
}
|
||||
resources {
|
||||
srcDir project.dirLang
|
||||
@@ -70,13 +73,13 @@ repositories {
|
||||
}
|
||||
|
||||
configurations {
|
||||
apis
|
||||
compile.extendsFrom apis
|
||||
api
|
||||
compile.extendsFrom api
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'net.industrial-craft:industrialcraft-2:2.2.575-experimental:api'
|
||||
apis 'com.mod-buildcraft:buildcraft:6.2.1:dev'
|
||||
api 'net.industrial-craft:industrialcraft-2:2.2.575-experimental:api'
|
||||
api 'com.mod-buildcraft:buildcraft:6.3.1:dev'
|
||||
}
|
||||
|
||||
processResources {
|
||||
@@ -178,12 +181,15 @@ jar {
|
||||
destinationDir = file("build/tmp")
|
||||
archiveName = "main.jar"
|
||||
|
||||
from {
|
||||
configurations.apis.collect {
|
||||
it.isDirectory() ? it : zipTree(it).matching {
|
||||
include '**/api/**'
|
||||
}
|
||||
}
|
||||
// Copy various READMEs and Licensing files into the jar
|
||||
into ('forestry/api') {
|
||||
from project.apiForestry + "/LICENSE.txt"
|
||||
}
|
||||
into ('cofh/api') {
|
||||
from project.apiRedstoneFlux + "/LICENSE - LGPLv3.txt"
|
||||
}
|
||||
into ('buildcraft/api') {
|
||||
from "./src/main/java/buildcraft/LICENSE-API"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +197,6 @@ task mainJarSigned ( type: Jar, dependsOn: 'reobf' ) {
|
||||
from (zipTree(jar.getArchivePath())) {
|
||||
exclude '**/api/**'
|
||||
exclude '**/codechicken/**'
|
||||
exclude '**/old/lang/**'
|
||||
}
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
@@ -218,7 +223,6 @@ task mainJar ( type: Zip, dependsOn: mainJarSigned ) {
|
||||
from (zipTree(jar.getArchivePath())) {
|
||||
include '**'
|
||||
exclude '**/codechicken/**'
|
||||
exclude '**/old/lang/**'
|
||||
}
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
@@ -231,7 +235,6 @@ task devJarSigned ( type: Jar, dependsOn: 'classes' ) {
|
||||
from(sourceSets.main.output) {
|
||||
exclude '**/api/**'
|
||||
exclude '**/codechicken/**'
|
||||
exclude '**/old/lang/**'
|
||||
}
|
||||
|
||||
destinationDir = file("build/tmp")
|
||||
@@ -257,21 +260,11 @@ task devJar ( type: Zip, dependsOn: devJarSigned ) {
|
||||
from(sourceSets.main.allSource) {
|
||||
include '**'
|
||||
exclude '**/codechicken/**'
|
||||
exclude '**/old/lang/**'
|
||||
}
|
||||
|
||||
from(sourceSets.main.output) {
|
||||
include '**'
|
||||
exclude '**/codechicken/**'
|
||||
exclude '**/old/lang/**'
|
||||
}
|
||||
|
||||
from {
|
||||
configurations.apis.collect {
|
||||
it.isDirectory() ? it : zipTree(it).matching {
|
||||
include '**/api/**'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
@@ -282,9 +275,7 @@ task devJar ( type: Zip, dependsOn: devJarSigned ) {
|
||||
}
|
||||
|
||||
task apiJar(type: Jar, dependsOn: 'classes') {
|
||||
from (dirApi) {
|
||||
include '**'
|
||||
}
|
||||
from project.apiForestry
|
||||
|
||||
from (sourceSets.main.output) {
|
||||
include 'forestry/api/**'
|
||||
@@ -295,14 +286,19 @@ task apiJar(type: Jar, dependsOn: 'classes') {
|
||||
classifier = 'api'
|
||||
}
|
||||
|
||||
task release(dependsOn: [apiJar, devJar, mainJar]) {
|
||||
doLast {
|
||||
println '*************************************************************'
|
||||
println 'This build will be version: ' + project.version
|
||||
println '*************************************************************'
|
||||
}
|
||||
task releaseInit << {
|
||||
println '*************************************************************'
|
||||
println 'This build will be version: ' + rootProject.version
|
||||
println '*************************************************************'
|
||||
}
|
||||
|
||||
task release (dependsOn: [releaseInit, apiJar, devJar, mainJar]) {
|
||||
}
|
||||
|
||||
mainJar.shouldRunAfter releaseInit
|
||||
devJar.shouldRunAfter releaseInit
|
||||
apiJar.shouldRunAfter releaseInit
|
||||
|
||||
afterEvaluate {
|
||||
compileApiJava.dependsOn initCraftGuide
|
||||
}
|
||||
|
||||
+1
-1
Submodule lang updated: 3c34adcc54...1b85a75323.
@@ -0,0 +1,21 @@
|
||||
BuildCraft API License
|
||||
|
||||
Copyright (c) 2011-2014 SpaceToad and the BuildCraft team
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* 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;
|
||||
@@ -1,11 +0,0 @@
|
||||
package cofh.api;
|
||||
|
||||
public class CoFHAPIProps {
|
||||
|
||||
private CoFHAPIProps() {
|
||||
|
||||
}
|
||||
|
||||
public static final String VERSION = "1.7.10R1.0.1";
|
||||
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyStorage}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class EnergyStorage implements IEnergyStorage {
|
||||
|
||||
protected int energy;
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
|
||||
public EnergyStorage(int capacity) {
|
||||
|
||||
this(capacity, capacity, capacity);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxTransfer) {
|
||||
|
||||
this(capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxReceive, int maxExtract) {
|
||||
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public EnergyStorage readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
this.energy = nbt.getInteger("Energy");
|
||||
|
||||
if (energy > capacity) {
|
||||
energy = capacity;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||
|
||||
if (energy < 0) {
|
||||
energy = 0;
|
||||
}
|
||||
nbt.setInteger("Energy", energy);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public void setCapacity(int capacity) {
|
||||
|
||||
this.capacity = capacity;
|
||||
|
||||
if (energy > capacity) {
|
||||
energy = capacity;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMaxTransfer(int maxTransfer) {
|
||||
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
|
||||
public void setMaxReceive(int maxReceive) {
|
||||
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
|
||||
public void setMaxExtract(int maxExtract) {
|
||||
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public int getMaxReceive() {
|
||||
|
||||
return maxReceive;
|
||||
}
|
||||
|
||||
public int getMaxExtract() {
|
||||
|
||||
return maxExtract;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers are
|
||||
* guaranteed to have it.
|
||||
*
|
||||
* @param energy
|
||||
*/
|
||||
public void setEnergyStored(int energy) {
|
||||
|
||||
this.energy = energy;
|
||||
|
||||
if (this.energy > capacity) {
|
||||
this.energy = capacity;
|
||||
} else if (this.energy < 0) {
|
||||
this.energy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this
|
||||
* externally, as not all IEnergyHandlers are guaranteed to have it.
|
||||
*
|
||||
* @param energy
|
||||
*/
|
||||
public void modifyEnergyStored(int energy) {
|
||||
|
||||
this.energy += energy;
|
||||
|
||||
if (this.energy > capacity) {
|
||||
this.energy = capacity;
|
||||
} else if (this.energy < 0) {
|
||||
this.energy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* IEnergyStorage */
|
||||
@Override
|
||||
public int receiveEnergy(int maxReceive, boolean simulate) {
|
||||
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
if (!simulate) {
|
||||
energy += energyReceived;
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(int maxExtract, boolean simulate) {
|
||||
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if (!simulate) {
|
||||
energy -= energyExtracted;
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
|
||||
return energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not
|
||||
* accept it; otherwise just use IEnergyHandler.
|
||||
*
|
||||
* Note that {@link IEnergyHandler} is an extension of this.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyConnection {
|
||||
|
||||
/**
|
||||
* Returns TRUE if the TileEntity can connect on a given side.
|
||||
*/
|
||||
boolean canConnectEnergy(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes that support external manipulation of their internal energy storages.
|
||||
*
|
||||
* A reference implementation is provided {@link ItemEnergyContainer}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyContainerItem {
|
||||
|
||||
/**
|
||||
* Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged.
|
||||
*
|
||||
* @param container
|
||||
* ItemStack to be charged.
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to be sent into the item.
|
||||
* @param simulate
|
||||
* If TRUE, the charge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) received by the item.
|
||||
*/
|
||||
int receiveEnergy(ItemStack container, int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally
|
||||
* discharged.
|
||||
*
|
||||
* @param container
|
||||
* ItemStack to be discharged.
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to be extracted from the item.
|
||||
* @param simulate
|
||||
* If TRUE, the discharge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted from the item.
|
||||
*/
|
||||
int extractEnergy(ItemStack container, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Get the amount of energy currently stored in the container item.
|
||||
*/
|
||||
int getEnergyStored(ItemStack container);
|
||||
|
||||
/**
|
||||
* Get the max amount of energy that can be stored in the container item.
|
||||
*/
|
||||
int getMaxEnergyStored(ItemStack container);
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
*
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyHandler extends IEnergyConnection {
|
||||
|
||||
/**
|
||||
* Add energy to an IEnergyHandler, internal distribution is left entirely to the IEnergyHandler.
|
||||
*
|
||||
* @param from
|
||||
* Orientation the energy is received from.
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to receive.
|
||||
* @param simulate
|
||||
* If TRUE, the charge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) received.
|
||||
*/
|
||||
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Remove energy from an IEnergyHandler, internal distribution is left entirely to the IEnergyHandler.
|
||||
*
|
||||
* @param from
|
||||
* Orientation the energy is extracted from.
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to extract.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted.
|
||||
*/
|
||||
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
/**
|
||||
* An energy storage is the unit of interaction with Energy inventories.
|
||||
*
|
||||
* A reference implementation can be found at {@link EnergyStorage}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyStorage {
|
||||
|
||||
/**
|
||||
* Adds energy to the storage. Returns quantity of energy that was accepted.
|
||||
*
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to be inserted.
|
||||
* @param simulate
|
||||
* If TRUE, the insertion will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) accepted by the storage.
|
||||
*/
|
||||
int receiveEnergy(int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Removes energy from the storage. Returns quantity of energy that was removed.
|
||||
*
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to be extracted.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted from the storage.
|
||||
*/
|
||||
int extractEnergy(int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored();
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored();
|
||||
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
||||
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
|
||||
public ItemEnergyContainer() {
|
||||
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity) {
|
||||
|
||||
this(capacity, capacity, capacity);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity, int maxTransfer) {
|
||||
|
||||
this(capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity, int maxReceive, int maxExtract) {
|
||||
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public ItemEnergyContainer setCapacity(int capacity) {
|
||||
|
||||
this.capacity = capacity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setMaxTransfer(int maxTransfer) {
|
||||
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
|
||||
public void setMaxReceive(int maxReceive) {
|
||||
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
|
||||
public void setMaxExtract(int maxExtract) {
|
||||
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
/* IEnergyContainerItem */
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
|
||||
if (container.stackTagCompound == null) {
|
||||
container.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
if (!simulate) {
|
||||
energy += energyReceived;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if (!simulate) {
|
||||
energy -= energyExtracted;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack container) {
|
||||
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
return container.stackTagCompound.getInteger("Energy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack container) {
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyHandler}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class TileEnergyHandler extends TileEntity implements IEnergyHandler {
|
||||
|
||||
protected final EnergyStorage storage = new EnergyStorage(32000);
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
super.readFromNBT(nbt);
|
||||
storage.readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
|
||||
super.writeToNBT(nbt);
|
||||
storage.writeToNBT(nbt);
|
||||
}
|
||||
|
||||
/* IEnergyHandler */
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
|
||||
return storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
|
||||
return storage.extractEnergy(maxExtract, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
|
||||
return storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
|
||||
return storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||
* http://www.teamcofh.com
|
||||
*/
|
||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|energy")
|
||||
package cofh.api.energy;
|
||||
|
||||
import cofh.api.CoFHAPIProps;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
/**
|
||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||
* http://www.teamcofh.com
|
||||
*/
|
||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI")
|
||||
package cofh.api;
|
||||
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -39,6 +39,9 @@ import forestry.core.utils.FluidMap;
|
||||
import forestry.core.utils.ItemStackMap;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
@@ -63,6 +66,22 @@ 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>();
|
||||
@@ -129,21 +148,12 @@ public class Forestry {
|
||||
if (block != null) {
|
||||
mapping.remap(Item.getItemFromBlock(block));
|
||||
Proxies.log.warning("Remapping item " + mapping.name + " to " + StringUtil.cleanBlockName(block));
|
||||
} else if (mapping.name.equals("Forestry:builderBackpack")) {
|
||||
mapping.remap(ForestryItem.builderBackpack.item());
|
||||
Proxies.log.warning("Remapping item " + mapping.name + " to " + ForestryItem.builderBackpack.name());
|
||||
} else if (mapping.name.equals("Forestry:builderBackpackT2")) {
|
||||
mapping.remap(ForestryItem.builderBackpackT2.item());
|
||||
Proxies.log.warning("Remapping item " + mapping.name + " to " + ForestryItem.builderBackpackT2.name());
|
||||
} else if (mapping.name.equals("Forestry:adventurerBackpack")) {
|
||||
mapping.remap(ForestryItem.adventurerBackpack.item());
|
||||
Proxies.log.warning("Remapping item " + mapping.name + " to " + ForestryItem.adventurerBackpack.name());
|
||||
} else if (mapping.name.equals("Forestry:adventurerBackpackT2")) {
|
||||
mapping.remap(ForestryItem.adventurerBackpackT2.item());
|
||||
Proxies.log.warning("Remapping item " + mapping.name + " to " + ForestryItem.adventurerBackpackT2.name());
|
||||
} else if (mapping.name.equals("Forestry:shortMead")) {
|
||||
mapping.remap(ForestryItem.beverage.item());
|
||||
Proxies.log.warning("Remapping item " + mapping.name + " to " + ForestryItem.beverage.name());
|
||||
} else {
|
||||
ForestryItem mappedItem = mappedItems.get(mapping.name);
|
||||
if (mappedItem != null) {
|
||||
mapping.remap(mappedItem.item());
|
||||
Proxies.log.warning("Remapping item " + mapping.name + " to " + mappedItem.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,24 +10,23 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import java.util.Stack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
@@ -261,7 +260,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
try {
|
||||
boolean canWork = true;
|
||||
// Not while raining, at night or without light
|
||||
EnumErrorCode state = queen.canWork(housing);
|
||||
IErrorState state = queen.canWork(housing);
|
||||
if (state != EnumErrorCode.OK) {
|
||||
housing.setErrorState(state);
|
||||
canWork = false;
|
||||
@@ -270,6 +269,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
}
|
||||
return canWork;
|
||||
} catch (Error e) {
|
||||
Proxies.log.logErrorAPI("Forestry", e, IBee.class);
|
||||
return queenCanWorkDeprecated();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,18 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public class FlowerProviderCacti implements IFlowerProvider {
|
||||
|
||||
@@ -42,10 +40,7 @@ public class FlowerProviderCacti implements IFlowerProvider {
|
||||
}
|
||||
|
||||
private boolean checkFlowerPot(int meta) {
|
||||
if (meta == 9)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return meta == 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,19 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import java.util.EnumSet;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public class FlowerProviderEnd implements IFlowerProvider {
|
||||
|
||||
|
||||
@@ -10,20 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import java.util.EnumSet;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public class FlowerProviderGourd implements IFlowerProvider {
|
||||
|
||||
|
||||
@@ -10,20 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import java.util.EnumSet;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public class FlowerProviderJungle implements IFlowerProvider {
|
||||
|
||||
@@ -46,10 +43,7 @@ public class FlowerProviderJungle implements IFlowerProvider {
|
||||
}
|
||||
|
||||
private boolean checkFlowerPot(int meta) {
|
||||
if (meta == 11)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return meta == 11;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,20 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import java.util.EnumSet;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public class FlowerProviderMushroom implements IFlowerProvider {
|
||||
|
||||
@@ -45,10 +42,7 @@ public class FlowerProviderMushroom implements IFlowerProvider {
|
||||
}
|
||||
|
||||
private boolean checkFlowerPot(int meta) {
|
||||
if (meta == 7 || meta == 8)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return meta == 7 || meta == 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,18 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public class FlowerProviderNetherwart implements IFlowerProvider {
|
||||
|
||||
|
||||
@@ -10,16 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
@@ -27,6 +17,13 @@ import forestry.api.genetics.IPollinatable;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public class FlowerProviderVanilla implements IFlowerProvider {
|
||||
|
||||
@@ -56,10 +53,7 @@ public class FlowerProviderVanilla implements IFlowerProvider {
|
||||
}
|
||||
|
||||
private boolean checkFlowerPot(int meta) {
|
||||
if (meta == 1 || meta == 2)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return meta == 1 || meta == 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,20 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import java.util.EnumSet;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public class FlowerProviderWheat implements IFlowerProvider {
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import forestry.apiculture.gui.ContainerAlvearyHygroregulator;
|
||||
import forestry.apiculture.gui.ContainerAlvearySieve;
|
||||
import forestry.apiculture.gui.ContainerAlvearySwarmer;
|
||||
import forestry.apiculture.gui.ContainerApiary;
|
||||
import forestry.apiculture.gui.ContainerBeealyzer;
|
||||
import forestry.apiculture.gui.ContainerHabitatLocator;
|
||||
import forestry.apiculture.gui.ContainerImprinter;
|
||||
import forestry.apiculture.gui.GuiAlveary;
|
||||
@@ -41,6 +40,7 @@ import forestry.apiculture.items.ItemBeealyzer.BeealyzerInventory;
|
||||
import forestry.apiculture.items.ItemBiomefinder.BiomefinderInventory;
|
||||
import forestry.apiculture.items.ItemImprinter.ImprinterInventory;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class GuiHandlerApiculture extends GuiHandlerBase {
|
||||
return new GuiApiary(player.inventory, (TileApiary) getTileForestry(world, x, y, z));
|
||||
|
||||
case BeealyzerGUI:
|
||||
equipped = getEquippedItem(player);
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null)
|
||||
return null;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class GuiHandlerApiculture extends GuiHandlerBase {
|
||||
return new GuiApiary(player.inventory, (TileBeehouse) getTileForestry(world, x, y, z));
|
||||
|
||||
case HabitatLocatorGUI:
|
||||
equipped = getEquippedItem(player);
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null)
|
||||
return null;
|
||||
|
||||
@@ -93,7 +93,10 @@ public class GuiHandlerApiculture extends GuiHandlerBase {
|
||||
return new GuiAlvearyHygroregulator(player.inventory, (TileAlvearyHygroregulator) getTileForestry(world, x, y, z));
|
||||
|
||||
case ImprinterGUI:
|
||||
return new GuiImprinter(player.inventory, new ImprinterInventory(player));
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null)
|
||||
return null;
|
||||
return new GuiImprinter(player.inventory, new ImprinterInventory(player, equipped));
|
||||
|
||||
default:
|
||||
return null;
|
||||
@@ -130,19 +133,19 @@ public class GuiHandlerApiculture extends GuiHandlerBase {
|
||||
return new ContainerApiary(player.inventory, (TileApiary) getTileForestry(world, x, y, z), true);
|
||||
|
||||
case BeealyzerGUI:
|
||||
equipped = getEquippedItem(player);
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null)
|
||||
return null;
|
||||
|
||||
synchApiaristTracker(world, player);
|
||||
return new ContainerBeealyzer(player.inventory, new BeealyzerInventory(player, equipped));
|
||||
return new ContainerAlyzer(new BeealyzerInventory(player, equipped), player);
|
||||
|
||||
case BeehouseGUI:
|
||||
synchApiaristTracker(world, player);
|
||||
return new ContainerApiary(player.inventory, (TileBeehouse) getTileForestry(world, x, y, z), false);
|
||||
|
||||
case HabitatLocatorGUI:
|
||||
equipped = getEquippedItem(player);
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null)
|
||||
return null;
|
||||
|
||||
@@ -153,7 +156,10 @@ public class GuiHandlerApiculture extends GuiHandlerBase {
|
||||
|
||||
case ImprinterGUI:
|
||||
synchApiaristTracker(world, player);
|
||||
return new ContainerImprinter(player.inventory, new ImprinterInventory(player));
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null)
|
||||
return null;
|
||||
return new ContainerImprinter(player.inventory, new ImprinterInventory(player, equipped));
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
@@ -10,15 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.apiculture.gui.ContainerImprinter;
|
||||
import forestry.core.interfaces.IPacketHandler;
|
||||
import forestry.core.network.PacketCoordinates;
|
||||
import forestry.core.network.PacketIds;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import java.io.DataInputStream;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class PacketHandlerApiculture implements IPacketHandler {
|
||||
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.interfaces.ISaveEventHandler;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class SaveEventHandlerApiculture implements ISaveEventHandler {
|
||||
|
||||
|
||||
@@ -10,9 +10,19 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.apiculture.genetics.BeeTemplates;
|
||||
import forestry.apiculture.items.ItemHoneycomb;
|
||||
import forestry.apiculture.worldgen.ComponentVillageBeeHouse;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -23,24 +33,13 @@ import net.minecraft.village.MerchantRecipeList;
|
||||
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
||||
import net.minecraft.world.gen.structure.StructureVillagePieces;
|
||||
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.apiculture.genetics.BeeTemplates;
|
||||
import forestry.apiculture.items.ItemHoneycomb;
|
||||
import forestry.apiculture.worldgen.ComponentVillageBeeHouse;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class VillageHandlerApiculture implements IVillageCreationHandler, IVillageTradeHandler {
|
||||
|
||||
public static void registerVillageComponents() {
|
||||
try {
|
||||
MapGenStructureIO.func_143031_a(ComponentVillageBeeHouse.class, "Forestry:BeeHouse");
|
||||
} catch (Throwable e) {
|
||||
Proxies.log.severe("Failed to register village beehouse.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*******************************************************************************
|
||||
* 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.commands;
|
||||
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.core.commands.ICommandModeHelper;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BeeModeHelper implements ICommandModeHelper {
|
||||
|
||||
@Override
|
||||
public String[] getModeNames() {
|
||||
ArrayList<IBeekeepingMode> beekeepingModes = PluginApiculture.beeInterface.getBeekeepingModes();
|
||||
int modeStringCount = beekeepingModes.size();
|
||||
List<String> modeStrings = new ArrayList<String>(modeStringCount);
|
||||
for (IBeekeepingMode mode : beekeepingModes)
|
||||
modeStrings.add(mode.getName());
|
||||
|
||||
return modeStrings.toArray(new String[modeStringCount]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModeNameMatching(String desired) {
|
||||
IBeekeepingMode mode = PluginApiculture.beeInterface.getBeekeepingMode(desired);
|
||||
if (mode == null)
|
||||
return null;
|
||||
return mode.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModeName(World world) {
|
||||
return PluginApiculture.beeInterface.getBeekeepingMode(world).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMode(World world, String modeName) {
|
||||
PluginApiculture.beeInterface.setBeekeepingMode(world, modeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getDescription(String modeName) {
|
||||
IBeekeepingMode mode = PluginApiculture.beeInterface.getBeekeepingMode(modeName);
|
||||
return mode.getDescription();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.commands;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.core.commands.IStatsSaveHelper;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BeeStatsSaveHelper implements IStatsSaveHelper {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedSaveStatsString() {
|
||||
return "for.chat.command.forestry.bee.save.stats";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExtraInfo(Collection<String> statistics, IBreedingTracker breedingTracker) {
|
||||
IApiaristTracker tracker = (IApiaristTracker)breedingTracker;
|
||||
String discoveredLine = StatCollector.translateToLocal("for.chat.command.forestry.stats.save.key.discovered") + ":";
|
||||
statistics.add(discoveredLine);
|
||||
statistics.add(StringUtil.line(discoveredLine.length()));
|
||||
|
||||
String queen = StatCollector.translateToLocal("for.bees.grammar.queen.type");
|
||||
String princess = StatCollector.translateToLocal("for.bees.grammar.princess.type");
|
||||
String drone = StatCollector.translateToLocal("for.bees.grammar.drone.type");
|
||||
statistics.add(queen + ":\t\t" + tracker.getQueenCount());
|
||||
statistics.add(princess + ":\t" + tracker.getPrincessCount());
|
||||
statistics.add(drone + ":\t\t" + tracker.getDroneCount());
|
||||
statistics.add("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IAlleleSpecies> getSpecies() {
|
||||
Collection<IAlleleSpecies> species = new ArrayList<IAlleleSpecies>();
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values())
|
||||
if (allele instanceof IAlleleBeeSpecies)
|
||||
species.add((IAlleleBeeSpecies) allele);
|
||||
return species;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileSuffix() {
|
||||
return "bees";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBreedingTracker getBreedingTracker(World world, GameProfile gameProfile) {
|
||||
return PluginApiculture.beeInterface.getBreedingTracker(world, gameProfile);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*******************************************************************************
|
||||
* 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.commands;
|
||||
|
||||
import forestry.core.commands.CommandMode;
|
||||
import forestry.core.commands.CommandSaveStats;
|
||||
import forestry.core.commands.ICommandModeHelper;
|
||||
import forestry.core.commands.IStatsSaveHelper;
|
||||
import forestry.core.commands.SubCommand;
|
||||
|
||||
public class CommandBee extends SubCommand {
|
||||
|
||||
public CommandBee() {
|
||||
super("bee");
|
||||
addAlias("beekeeping");
|
||||
|
||||
IStatsSaveHelper saveHelper = new BeeStatsSaveHelper();
|
||||
ICommandModeHelper modeHelper = new BeeModeHelper();
|
||||
|
||||
addChildCommand(new CommandMode(modeHelper));
|
||||
addChildCommand(new CommandSaveStats(saveHelper, modeHelper));
|
||||
addChildCommand(new CommandBeeGive());
|
||||
}
|
||||
}
|
||||
+38
-29
@@ -16,25 +16,24 @@ import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.apiculture.SpeciesNotFoundException;
|
||||
import forestry.apiculture.TemplateNotFoundException;
|
||||
import forestry.core.commands.CommandHelpers;
|
||||
import forestry.core.commands.SpeciesNotFoundException;
|
||||
import forestry.core.commands.SubCommand;
|
||||
import forestry.core.commands.TemplateNotFoundException;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandBeekeepingGiveBee extends SubCommand {
|
||||
public class CommandBeeGive extends SubCommand {
|
||||
|
||||
private final String beeTypeHelpString;
|
||||
private final String[] beeTypeArr;
|
||||
|
||||
public CommandBeekeepingGiveBee() {
|
||||
public CommandBeeGive() {
|
||||
super("give");
|
||||
setPermLevel(PermLevel.ADMIN);
|
||||
|
||||
@@ -61,26 +60,46 @@ public class CommandBeekeepingGiveBee extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void processSubCommand(ICommandSender sender, String[] arguments) {
|
||||
if (arguments.length < 3) {
|
||||
if (arguments.length < 2) {
|
||||
printHelp(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
EnumBeeType beeType = getBeeType(arguments[0]);
|
||||
IBeeGenome beeGenome = getBeeGenome(arguments[0]);
|
||||
EnumBeeType beeType = getBeeType(arguments[1]);
|
||||
if (beeType == EnumBeeType.NONE) {
|
||||
printHelp(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayer player = CommandHelpers.getPlayer(sender, arguments[1]);
|
||||
EntityPlayer player;
|
||||
if (arguments.length == 3) {
|
||||
player = CommandHelpers.getPlayer(sender, arguments[2]);
|
||||
} else {
|
||||
player = CommandHelpers.getPlayer(sender, sender.getCommandSenderName());
|
||||
}
|
||||
if (player == null) {
|
||||
printHelp(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
String parameter = arguments[2];
|
||||
IBee bee = PluginApiculture.beeInterface.getBee(player.worldObj, beeGenome);
|
||||
|
||||
if(beeType == EnumBeeType.QUEEN)
|
||||
bee.mate(bee);
|
||||
|
||||
ItemStack beeStack = PluginApiculture.beeInterface.getMemberStack(bee, beeType.ordinal());
|
||||
player.dropPlayerItemWithRandomChoice(beeStack, true);
|
||||
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.bee.give.given", player.getCommandSenderName(), bee.getGenome().getPrimary().getName(), beeType.getName());
|
||||
}
|
||||
|
||||
private static IBeeGenome getBeeGenome(String speciesName) {
|
||||
IAlleleBeeSpecies species = null;
|
||||
|
||||
for (String uid : AlleleManager.alleleRegistry.getRegisteredAlleles().keySet()) {
|
||||
|
||||
if (!uid.equals(parameter))
|
||||
if (!uid.equals(speciesName))
|
||||
continue;
|
||||
|
||||
if (AlleleManager.alleleRegistry.getAllele(uid) instanceof IAlleleBeeSpecies) {
|
||||
@@ -91,7 +110,7 @@ public class CommandBeekeepingGiveBee extends SubCommand {
|
||||
|
||||
if (species == null) {
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
|
||||
if (allele instanceof IAlleleBeeSpecies && allele.getName().equals(parameter)) {
|
||||
if (allele instanceof IAlleleBeeSpecies && allele.getName().equals(speciesName)) {
|
||||
species = (IAlleleBeeSpecies) allele;
|
||||
break;
|
||||
}
|
||||
@@ -99,36 +118,26 @@ public class CommandBeekeepingGiveBee extends SubCommand {
|
||||
}
|
||||
|
||||
if (species == null)
|
||||
throw new SpeciesNotFoundException(parameter);
|
||||
throw new SpeciesNotFoundException(speciesName);
|
||||
|
||||
IAllele[] template = PluginApiculture.beeInterface.getTemplate(species.getUID());
|
||||
|
||||
if (template == null)
|
||||
throw new TemplateNotFoundException(species);
|
||||
|
||||
IBeeGenome genome = PluginApiculture.beeInterface.templateAsGenome(template);
|
||||
|
||||
IBee bee = PluginApiculture.beeInterface.getBee(player.worldObj, genome);
|
||||
|
||||
if(beeType == EnumBeeType.QUEEN)
|
||||
bee.mate(bee);
|
||||
|
||||
ItemStack beeStack = PluginApiculture.beeInterface.getMemberStack(bee, beeType.ordinal());
|
||||
player.dropPlayerItemWithRandomChoice(beeStack, true);
|
||||
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.beekeeping.give.given", player.getCommandSenderName(), template[0].getName(), beeType.getName());
|
||||
return PluginApiculture.beeInterface.templateAsGenome(template);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> addTabCompletionOptions(ICommandSender sender, String[] parameters) {
|
||||
if (parameters.length == 1) {
|
||||
List<String> tabCompletion = CommandHelpers.getListOfStringsMatchingLastWord(parameters, beeTypeArr);
|
||||
List<String> tabCompletion = CommandHelpers.getListOfStringsMatchingLastWord(parameters, getSpecies());
|
||||
tabCompletion.add("help");
|
||||
return tabCompletion;
|
||||
} else if (parameters.length == 2) {
|
||||
return CommandHelpers.getListOfStringsMatchingLastWord(parameters, CommandHelpers.getPlayers());
|
||||
return CommandHelpers.getListOfStringsMatchingLastWord(parameters, beeTypeArr);
|
||||
} else if (parameters.length == 3) {
|
||||
return CommandHelpers.getListOfStringsMatchingLastWord(parameters, getSpecies());
|
||||
return CommandHelpers.getListOfStringsMatchingLastWord(parameters, CommandHelpers.getPlayers());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -10,20 +10,18 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.passive.IAnimals;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.utils.ForestryResource;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.passive.IAnimals;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBee extends EntityCreature implements IAnimals {
|
||||
|
||||
|
||||
@@ -10,9 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.MaterialBeehive;
|
||||
import forestry.core.gadgets.BlockStructure;
|
||||
import forestry.core.render.TextureManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -23,14 +28,6 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.MaterialBeehive;
|
||||
import forestry.core.gadgets.BlockStructure;
|
||||
import forestry.core.render.TextureManager;
|
||||
|
||||
public class BlockAlveary extends BlockStructure {
|
||||
|
||||
public BlockAlveary() {
|
||||
|
||||
@@ -13,12 +13,18 @@ package forestry.apiculture.gadgets;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import forestry.api.apiculture.hives.HiveManager;
|
||||
import forestry.apiculture.worldgen.HiveRegistry;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.MaterialBeehive;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.inventory.InvTools;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -31,10 +37,6 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockBeehives extends BlockContainer {
|
||||
|
||||
public BlockBeehives() {
|
||||
@@ -42,6 +44,7 @@ public class BlockBeehives extends BlockContainer {
|
||||
setLightLevel(0.8f);
|
||||
setHardness(1.0f);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setHarvestLevel("scoop", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,7 +66,7 @@ public class BlockBeehives extends BlockContainer {
|
||||
if (tile instanceof TileSwarm) {
|
||||
TileSwarm swarm = (TileSwarm) tile;
|
||||
if (swarm.containsBees())
|
||||
for (ItemStack beeStack : swarm.contained.getStacks())
|
||||
for (ItemStack beeStack : InvTools.getStacks(swarm.contained))
|
||||
if (beeStack != null)
|
||||
StackUtils.dropItemStackAsEntity(beeStack, world, x, y, z);
|
||||
}
|
||||
@@ -125,18 +128,18 @@ public class BlockBeehives extends BlockContainer {
|
||||
String hiveName = getHiveNameForMeta(meta);
|
||||
if (hiveName == null)
|
||||
return Collections.emptyList();
|
||||
return HiveManager.get(hiveName).getDrops();
|
||||
return PluginApiculture.hiveRegistry.getDrops(hiveName);
|
||||
}
|
||||
|
||||
private String getHiveNameForMeta(int meta) {
|
||||
switch (meta) {
|
||||
case 1: return HiveManager.forest;
|
||||
case 2: return HiveManager.meadows;
|
||||
case 3: return HiveManager.desert;
|
||||
case 4: return HiveManager.jungle;
|
||||
case 5: return HiveManager.end;
|
||||
case 6: return HiveManager.snow;
|
||||
case 7: return HiveManager.swamp;
|
||||
case 1: return HiveRegistry.forest;
|
||||
case 2: return HiveRegistry.meadows;
|
||||
case 3: return HiveRegistry.desert;
|
||||
case 4: return HiveRegistry.jungle;
|
||||
case 5: return HiveRegistry.end;
|
||||
case 6: return HiveRegistry.snow;
|
||||
case 7: return HiveRegistry.swamp;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -10,10 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.ForestryClient;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -29,20 +36,9 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.ForestryClient;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class BlockCandle extends BlockTorch {
|
||||
|
||||
private final ArrayList<Item> lightingItems = new ArrayList<Item>();
|
||||
@@ -111,7 +107,7 @@ public class BlockCandle extends BlockTorch {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getTextureFromPassAndMeta(int meta, int pass) {
|
||||
IIcon i = this.unlitStump;
|
||||
IIcon i;
|
||||
if (pass == 0) {
|
||||
if (isLit(meta)) {
|
||||
i = this.litTip;
|
||||
@@ -180,6 +176,7 @@ public class BlockCandle extends BlockTorch {
|
||||
TileCandle te = (TileCandle)world.getTileEntity(x, y, z);
|
||||
if (te == null) {
|
||||
world.setTileEntity(x, y, z, this.createTileEntity(world, meta));
|
||||
te = (TileCandle)world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
if (StackUtils.equals(this, held)) {
|
||||
|
||||
@@ -10,9 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -23,16 +30,6 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class BlockStump extends BlockTorch {
|
||||
|
||||
public BlockStump() {
|
||||
|
||||
@@ -10,12 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import forestry.api.apiculture.IAlvearyComponent;
|
||||
import forestry.api.core.ITileStructure;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
@@ -23,7 +17,11 @@ import forestry.core.gadgets.BlockStructure.EnumStructureState;
|
||||
import forestry.core.gadgets.StructureLogic;
|
||||
import forestry.core.utils.Schemata;
|
||||
import forestry.core.utils.Schemata.EnumStructureBlock;
|
||||
import forestry.core.utils.Vect;
|
||||
import forestry.core.vect.Vect;
|
||||
import java.util.HashSet;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class StructureLogicAlveary extends StructureLogic {
|
||||
|
||||
@@ -35,13 +33,11 @@ public class StructureLogicAlveary extends StructureLogic {
|
||||
|
||||
public static final HashSet<Block> slabBlocks = new HashSet<Block>();
|
||||
static {
|
||||
slabBlocks.add(Blocks.stone_slab);
|
||||
slabBlocks.add(Blocks.wooden_slab);
|
||||
slabBlocks.add(ForestryBlock.slabs1.block());
|
||||
slabBlocks.add(ForestryBlock.slabs2.block());
|
||||
slabBlocks.add(ForestryBlock.slabs3.block());
|
||||
if (ForestryBlock.slabs4.block() != null)
|
||||
slabBlocks.add(ForestryBlock.slabs4.block());
|
||||
slabBlocks.add(ForestryBlock.slabs4.block());
|
||||
}
|
||||
|
||||
public StructureLogicAlveary(ITileStructure structure) {
|
||||
|
||||
@@ -10,8 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import forestry.api.apiculture.IAlvearyComponent;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
@@ -21,18 +29,13 @@ import forestry.apiculture.trigger.ApicultureTriggers;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.gadgets.TileForestry;
|
||||
import forestry.core.inventory.FakeInventoryAdapter;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import forestry.core.utils.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
|
||||
public abstract class TileAlveary extends TileForestry implements IAlvearyComponent {
|
||||
|
||||
@@ -40,8 +43,6 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
private boolean isMaster;
|
||||
protected int masterX, masterZ;
|
||||
protected int masterY = -99;
|
||||
|
||||
protected TileInventoryAdapter inventory;
|
||||
protected final int componentBlockMeta;
|
||||
|
||||
public TileAlveary(int componentBlockMeta) {
|
||||
@@ -92,8 +93,6 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
/* LOADING & SAVING */
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
|
||||
this.isMaster = nbttagcompound.getBoolean("IsMaster");
|
||||
this.masterX = nbttagcompound.getInteger("MasterX");
|
||||
this.masterY = nbttagcompound.getInteger("MasterY");
|
||||
@@ -101,7 +100,9 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
|
||||
// Init for master state
|
||||
if (isMaster)
|
||||
makeMaster();
|
||||
makeMaster();
|
||||
|
||||
super.readFromNBT(nbttagcompound);
|
||||
|
||||
structureLogic.readFromNBT(nbttagcompound);
|
||||
}
|
||||
@@ -122,16 +123,26 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromPacketPayload(PacketPayload payload) {
|
||||
public PacketPayload getPacketPayload() {
|
||||
PacketPayload payload = new PacketPayload(0, 2);
|
||||
payload.shortPayload[0] = (short) (isMaster() ? 1 : 0);
|
||||
|
||||
// so the client can know if it is part of an integrated structure
|
||||
payload.shortPayload[1] = (short) this.masterY;
|
||||
|
||||
return payload;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketPayload getPacketPayload() {
|
||||
return null;
|
||||
public void fromPacketPayload(PacketPayload payload) {
|
||||
if (payload.shortPayload[0] > 0)
|
||||
makeMaster();
|
||||
|
||||
// so the client can know if it is part of an integrated structure
|
||||
this.masterY = payload.shortPayload[1];
|
||||
}
|
||||
|
||||
/* ITILESTRUCTURE */
|
||||
|
||||
@Override
|
||||
public String getTypeUID() {
|
||||
return structureLogic.getTypeUID();
|
||||
@@ -147,7 +158,7 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
setCentralTE(null);
|
||||
isMaster = true;
|
||||
|
||||
if (inventory == null)
|
||||
if (getInternalInventory() instanceof FakeInventoryAdapter)
|
||||
createInventory();
|
||||
}
|
||||
|
||||
@@ -214,8 +225,13 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventory() {
|
||||
return inventory;
|
||||
public final IInventoryAdapter getInventory() {
|
||||
return getStructureInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventoryAdapter getStructureInventory() {
|
||||
return getInternalInventory();
|
||||
}
|
||||
|
||||
/* IALVEARY COMPONENT */
|
||||
@@ -258,9 +274,4 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return Utils.isUseableByPlayer(player, this, worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,22 +19,20 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import forestry.api.apiculture.IAlvearyComponent;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
|
||||
public class TileAlvearyHygroregulator extends TileAlveary implements IInventory, ILiquidTankContainer {
|
||||
|
||||
@@ -43,6 +41,7 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
|
||||
/* RECIPE MANAGMENT */
|
||||
private static class HygroregulatorRecipe {
|
||||
|
||||
public final FluidStack liquid;
|
||||
public final int transferTime;
|
||||
public final float humidChange;
|
||||
@@ -56,10 +55,11 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
}
|
||||
}
|
||||
|
||||
public static final short SLOT_INPUT = 0;
|
||||
|
||||
private final HygroregulatorRecipe[] recipes;
|
||||
|
||||
/* MEMBERS */
|
||||
private final InventoryAdapter canInventory = new InventoryAdapter(1, "CanInv");
|
||||
private final TankManager tankManager;
|
||||
private final FilteredTank liquidTank;
|
||||
|
||||
@@ -69,16 +69,27 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
public TileAlvearyHygroregulator() {
|
||||
super(BLOCK_META);
|
||||
|
||||
Fluid water = LiquidHelper.getFluid(Defaults.LIQUID_WATER);
|
||||
Fluid lava = LiquidHelper.getFluid(Defaults.LIQUID_LAVA);
|
||||
Fluid liquidIce = LiquidHelper.getFluid(Defaults.LIQUID_ICE);
|
||||
setInternalInventory(new TileInventoryAdapter(this, 1, "CanInv") {
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == SLOT_INPUT) {
|
||||
Fluid fluid = FluidHelper.getFluidInContainer(itemStack);
|
||||
return liquidTank.accepts(fluid);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
Fluid water = Fluids.WATER.getFluid();
|
||||
Fluid lava = Fluids.LAVA.getFluid();
|
||||
Fluid liquidIce = Fluids.ICE.getFluid();
|
||||
|
||||
liquidTank = new FilteredTank(Defaults.PROCESSOR_TANK_CAPACITY, water, lava, liquidIce);
|
||||
tankManager = new TankManager(liquidTank);
|
||||
|
||||
recipes = new HygroregulatorRecipe[] { new HygroregulatorRecipe(new FluidStack(water, 1), 1, 0.01f, -0.005f),
|
||||
new HygroregulatorRecipe(new FluidStack(lava, 1), 10, -0.01f, +0.005f),
|
||||
new HygroregulatorRecipe(new FluidStack(liquidIce, 1), 10, 0.02f, -0.01f) };
|
||||
recipes = new HygroregulatorRecipe[]{new HygroregulatorRecipe(new FluidStack(water, 1), 1, 0.01f, -0.005f),
|
||||
new HygroregulatorRecipe(new FluidStack(lava, 1), 10, -0.01f, +0.005f),
|
||||
new HygroregulatorRecipe(new FluidStack(liquidIce, 1), 10, 0.02f, -0.01f)};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,19 +97,15 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
player.openGui(ForestryAPI.instance, GuiId.HygroregulatorGUI.ordinal(), worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
/* UPDATING */
|
||||
private HygroregulatorRecipe getRecipe(FluidStack liquid) {
|
||||
HygroregulatorRecipe recipe = null;
|
||||
for (HygroregulatorRecipe rec : recipes)
|
||||
for (HygroregulatorRecipe rec : recipes) {
|
||||
if (rec.liquid.isFluidEqual(liquid)) {
|
||||
recipe = rec;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@@ -131,17 +138,11 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
if (worldObj.getTotalWorldTime() % 20 * 10 != 0)
|
||||
return;
|
||||
|
||||
// Check if we have suitable items waiting in the item slot
|
||||
if (canInventory.getStackInSlot(0) != null) {
|
||||
FluidContainerData container = LiquidHelper.getLiquidContainer(canInventory.getStackInSlot(0));
|
||||
if (container != null &&
|
||||
(container.fluid.getFluid() == FluidRegistry.WATER || container.fluid.getFluid() == FluidRegistry.LAVA)) {
|
||||
IInventoryAdapter canInventory = getInternalInventory();
|
||||
|
||||
canInventory.setInventorySlotContents(0, StackUtils.replenishByContainer(this, canInventory.getStackInSlot(0), container, liquidTank));
|
||||
if (canInventory.getStackInSlot(0).stackSize <= 0)
|
||||
canInventory.setInventorySlotContents(0, null);
|
||||
}
|
||||
}
|
||||
// Check if we have suitable items waiting in the item slot
|
||||
if (canInventory.getStackInSlot(0) != null)
|
||||
FluidHelper.drainContainers(tankManager, canInventory, 0);
|
||||
|
||||
}
|
||||
|
||||
@@ -154,9 +155,6 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
|
||||
canInventory.readFromNBT(nbttagcompound);
|
||||
|
||||
tankManager.readTanksFromNBT(nbttagcompound);
|
||||
|
||||
transferTime = nbttagcompound.getInteger("TransferTime");
|
||||
@@ -170,9 +168,6 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
|
||||
canInventory.writeToNBT(nbttagcompound);
|
||||
|
||||
tankManager.writeTanksToNBT(nbttagcompound);
|
||||
|
||||
nbttagcompound.setInteger("TransferTime", transferTime);
|
||||
@@ -190,101 +185,6 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
return BlockAlveary.ALVEARY_HYGRO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventory() {
|
||||
return canInventory;
|
||||
}
|
||||
|
||||
/* IINVENTORY */
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
if (canInventory != null)
|
||||
return canInventory.getSizeInventory();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slotIndex) {
|
||||
if (canInventory != null)
|
||||
return canInventory.getStackInSlot(slotIndex);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slotIndex, int amount) {
|
||||
if (canInventory != null)
|
||||
return canInventory.decrStackSize(slotIndex, amount);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slotIndex) {
|
||||
if (canInventory != null)
|
||||
return canInventory.getStackInSlotOnClosing(slotIndex);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slotIndex, ItemStack itemstack) {
|
||||
// Client side handling for container synch
|
||||
if (canInventory == null && !Proxies.common.isSimulating(worldObj))
|
||||
createInventory();
|
||||
|
||||
if (canInventory != null)
|
||||
canInventory.setInventorySlotContents(slotIndex, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
if (canInventory != null)
|
||||
return canInventory.getInventoryStackLimit();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return super.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return super.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||
if (slotIndex == 0) {
|
||||
FluidStack fluid = LiquidHelper.getFluidStackInContainer(itemstack);
|
||||
if (fluid == null || fluid.amount <= 0)
|
||||
return false;
|
||||
return liquidTank.accepts(fluid.getFluid());
|
||||
}
|
||||
|
||||
return super.isItemValidForSlot(slotIndex, itemstack);
|
||||
}
|
||||
|
||||
/* ILIQUIDTANKCONTAINER */
|
||||
@Override
|
||||
public TankManager getTankManager() {
|
||||
@@ -296,6 +196,7 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
return tankManager.fill(from, resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
return tankManager.drain(from, resource, doDrain);
|
||||
}
|
||||
@@ -321,8 +222,10 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGUINetworkData(int messageId, int data) {}
|
||||
public void getGUINetworkData(int messageId, int data) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendGUINetworkData(Container container, ICrafting iCrafting) {}
|
||||
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
|
||||
}
|
||||
}
|
||||
@@ -10,35 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
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.IBeekeepingLogic;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.ISpecialInventory;
|
||||
import forestry.api.core.ITileStructure;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.apiculture.gui.ContainerAlveary;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.interfaces.IClimatised;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
import forestry.core.interfaces.IHintSource;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.PacketIds;
|
||||
import forestry.core.network.PacketInventoryStack;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -47,12 +21,40 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, ISpecialInventory, IBeeHousing, IClimatised, IHintSource {
|
||||
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.IBeekeepingLogic;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.core.ITileStructure;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.apiculture.gui.ContainerAlveary;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.interfaces.IClimatised;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
import forestry.core.interfaces.IHintSource;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.InvTools;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.PacketIds;
|
||||
import forestry.core.network.PacketInventoryStack;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IBeeHousing, IClimatised, IHintSource {
|
||||
|
||||
// / CONSTANTS
|
||||
public static final int SLOT_QUEEN = 0;
|
||||
@@ -100,8 +102,6 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
this.tempChange = nbttagcompound.getFloat("TempChange");
|
||||
this.humidChange = nbttagcompound.getFloat("HumidChange");
|
||||
|
||||
if (inventory != null)
|
||||
inventory.readFromNBT(nbttagcompound);
|
||||
if (beekeepingLogic != null)
|
||||
beekeepingLogic.readFromNBT(nbttagcompound);
|
||||
|
||||
@@ -114,8 +114,6 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
nbttagcompound.setFloat("TempChange", tempChange);
|
||||
nbttagcompound.setFloat("HumidChange", humidChange);
|
||||
|
||||
if (inventory != null)
|
||||
inventory.writeToNBT(nbttagcompound);
|
||||
if (beekeepingLogic != null)
|
||||
beekeepingLogic.writeToNBT(nbttagcompound);
|
||||
|
||||
@@ -147,8 +145,12 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
return;
|
||||
|
||||
// Add swarm effects
|
||||
if (worldObj.getTotalWorldTime() % 200 * 10 == 0)
|
||||
onQueenChange(inventory.getStackInSlot(SLOT_QUEEN));
|
||||
if (worldObj.getTotalWorldTime() % 200 == 0) {
|
||||
ISidedInventory inventory = getStructureInventory();
|
||||
if (inventory != null)
|
||||
onQueenChange(inventory.getStackInSlot(SLOT_QUEEN));
|
||||
}
|
||||
|
||||
if (getErrorState() == EnumErrorCode.OK)
|
||||
queen.doFX(beekeepingLogic.getEffectData(), this);
|
||||
|
||||
@@ -173,13 +175,15 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
if (!isMaster())
|
||||
return;
|
||||
|
||||
ISidedInventory inventory = getStructureInventory();
|
||||
if (inventory == null)
|
||||
return;
|
||||
|
||||
// / Multiplayer FX
|
||||
if (PluginApiculture.beeInterface.isMated(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
ItemStack queenStack = inventory.getStackInSlot(SLOT_QUEEN);
|
||||
if (PluginApiculture.beeInterface.isMated(queenStack)) {
|
||||
if (getErrorState() == EnumErrorCode.OK && worldObj.getTotalWorldTime() % 2 == 0) {
|
||||
IBee displayQueen = PluginApiculture.beeInterface.getMember(inventory.getStackInSlot(SLOT_QUEEN));
|
||||
IBee displayQueen = PluginApiculture.beeInterface.getMember(queenStack);
|
||||
displayQueen.doFX(beekeepingLogic.getEffectData(), this);
|
||||
}
|
||||
}
|
||||
@@ -205,6 +209,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
|
||||
/* STATE INFORMATION */
|
||||
private int getHealthDisplay() {
|
||||
IInventory inventory = getStructureInventory();
|
||||
if (inventory == null || inventory.getStackInSlot(SLOT_QUEEN) == null)
|
||||
return 0;
|
||||
|
||||
@@ -217,6 +222,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
}
|
||||
|
||||
private int getMaxHealthDisplay() {
|
||||
IInventory inventory = getStructureInventory();
|
||||
if (inventory == null || inventory.getStackInSlot(SLOT_QUEEN) == null)
|
||||
return 0;
|
||||
|
||||
@@ -235,18 +241,24 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
return (getHealthDisplay() * i) / getMaxHealthDisplay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowsInteraction(EntityPlayer player) {
|
||||
if (!super.allowsInteraction(player))
|
||||
return false;
|
||||
|
||||
return this.isIntegratedIntoStructure();
|
||||
}
|
||||
|
||||
/* STRUCTURE MANAGMENT */
|
||||
@Override
|
||||
protected void createInventory() {
|
||||
this.inventory = new TileInventoryAdapter(this, 9, "Items");
|
||||
setInternalInventory(new TileInventoryAdapter(this, 9, "Items") {
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == SLOT_QUEEN) {
|
||||
return PluginApiculture.beeInterface.isMember(itemStack) && !PluginApiculture.beeInterface.isDrone(itemStack);
|
||||
} else if (slotIndex == SLOT_DRONE) {
|
||||
return PluginApiculture.beeInterface.isDrone(itemStack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
return slotIndex != SLOT_QUEEN && slotIndex != SLOT_DRONE;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -424,7 +436,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
|
||||
@Override
|
||||
public int getErrorOrdinal() {
|
||||
return getErrorState().ordinal();
|
||||
return getErrorState().getID();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -434,10 +446,11 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
|
||||
@Override
|
||||
public boolean addProduct(ItemStack product, boolean all) {
|
||||
IInventoryAdapter inventory = getStructureInventory();
|
||||
if (inventory == null)
|
||||
return false;
|
||||
|
||||
return inventory.tryAddStack(product, SLOT_PRODUCT_1, inventory.getSizeInventory() - SLOT_PRODUCT_1, all);
|
||||
return InvTools.tryAddStack(inventory, product, SLOT_PRODUCT_1, inventory.getSizeInventory() - SLOT_PRODUCT_1, all);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -533,259 +546,37 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
|
||||
/* IINVENTORY */
|
||||
@Override
|
||||
public InventoryAdapter getInternalInventory() {
|
||||
return (InventoryAdapter) getStructureInventory();
|
||||
}
|
||||
|
||||
private IInventory getStructureInventory() {
|
||||
|
||||
if (inventory != null) {
|
||||
if (isMaster() || !Proxies.common.isSimulating(worldObj))
|
||||
return inventory;
|
||||
public IInventoryAdapter getInternalInventory() {
|
||||
IInventoryAdapter inventory = super.getInternalInventory();
|
||||
if (isMaster()) {
|
||||
return inventory;
|
||||
} else if (hasMaster()) {
|
||||
ITileStructure central = getCentralTE();
|
||||
if (central != null)
|
||||
return central.getInventory();
|
||||
if (central instanceof TileAlveary)
|
||||
return ((TileAlveary) central).getInternalInventory();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
IInventory inv = getStructureInventory();
|
||||
if (inv != null)
|
||||
return inv.getSizeInventory();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slotIndex) {
|
||||
IInventory inv = getStructureInventory();
|
||||
if (inv != null)
|
||||
return inv.getStackInSlot(slotIndex);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slotIndex, int amount) {
|
||||
IInventory inv = getStructureInventory();
|
||||
if (inv != null)
|
||||
return inv.decrStackSize(slotIndex, amount);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slotIndex) {
|
||||
IInventory inv = getStructureInventory();
|
||||
if (inv != null)
|
||||
return inv.getStackInSlotOnClosing(slotIndex);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slotIndex, ItemStack itemstack) {
|
||||
// Client side handling for container synch
|
||||
if (inventory == null && !Proxies.common.isSimulating(worldObj))
|
||||
createInventory();
|
||||
|
||||
IInventory inv = getStructureInventory();
|
||||
if (inv != null)
|
||||
inv.setInventorySlotContents(slotIndex, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
IInventory inv = getStructureInventory();
|
||||
if (inv != null)
|
||||
return inv.getInventoryStackLimit();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canTakeStackFromSide(int slotIndex, ItemStack itemstack, int side) {
|
||||
|
||||
if (!super.canTakeStackFromSide(slotIndex, itemstack, side))
|
||||
return false;
|
||||
|
||||
if (slotIndex != SLOT_QUEEN && slotIndex != SLOT_DRONE)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canPutStackFromSide(int slotIndex, ItemStack itemstack, int side) {
|
||||
|
||||
if (!super.canPutStackFromSide(slotIndex, itemstack, side))
|
||||
return false;
|
||||
|
||||
if (slotIndex == SLOT_QUEEN && PluginApiculture.beeInterface.isMember(itemstack)
|
||||
&& !PluginApiculture.beeInterface.isDrone(itemstack))
|
||||
return true;
|
||||
if (slotIndex == SLOT_DRONE && PluginApiculture.beeInterface.isDrone(itemstack))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return super.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return super.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||
return super.isItemValidForSlot(slotIndex, itemstack);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
return super.canInsertItem(i, itemstack, j);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return super.canExtractItem(i, itemstack, j);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return super.getAccessibleSlotsFromSide(side);
|
||||
}
|
||||
|
||||
/* ISPECIALINVENTORY */
|
||||
@Override
|
||||
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
|
||||
|
||||
IInventory inv = getStructureInventory();
|
||||
if (inv == null)
|
||||
return 0;
|
||||
|
||||
// Princesses && Queens
|
||||
if (ForestryItem.beePrincessGE.isItemEqual(stack) || ForestryItem.beeQueenGE.isItemEqual(stack))
|
||||
if (inv.getStackInSlot(SLOT_QUEEN) == null) {
|
||||
if (doAdd) {
|
||||
inv.setInventorySlotContents(SLOT_QUEEN, stack.copy());
|
||||
inv.getStackInSlot(SLOT_QUEEN).stackSize = 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Drones
|
||||
if (ForestryItem.beeDroneGE.isItemEqual(stack)) {
|
||||
|
||||
ItemStack droneStack = inv.getStackInSlot(SLOT_DRONE);
|
||||
if (droneStack == null) {
|
||||
if (doAdd)
|
||||
inv.setInventorySlotContents(SLOT_DRONE, stack.copy());
|
||||
return stack.stackSize;
|
||||
} else {
|
||||
if (!droneStack.isItemEqual(stack))
|
||||
return 0;
|
||||
if (!ItemStack.areItemStackTagsEqual(droneStack, stack))
|
||||
return 0;
|
||||
int space = droneStack.getMaxStackSize() - droneStack.stackSize;
|
||||
if (space <= 0)
|
||||
return 0;
|
||||
|
||||
int added = space > stack.stackSize ? stack.stackSize : space;
|
||||
if (doAdd)
|
||||
droneStack.stackSize += added;
|
||||
return added;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {
|
||||
|
||||
IInventory inv = getStructureInventory();
|
||||
if (inv == null)
|
||||
return new ItemStack[0];
|
||||
|
||||
ItemStack product = null;
|
||||
|
||||
for (int i = SLOT_PRODUCT_1; i < inv.getSizeInventory(); i++) {
|
||||
if (inv.getStackInSlot(i) == null)
|
||||
continue;
|
||||
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
|
||||
if (doRemove)
|
||||
product = inv.decrStackSize(i, 1);
|
||||
else {
|
||||
product = stack.copy();
|
||||
product.stackSize = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return new ItemStack[] { product };
|
||||
return inventory;
|
||||
}
|
||||
|
||||
/* SMP GUI */
|
||||
public void getGUINetworkData(int i, int j) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
displayHealth = j;
|
||||
break;
|
||||
case 1:
|
||||
displayHealthMax = j;
|
||||
break;
|
||||
case 4:
|
||||
this.tempChange = (float) j / 100;
|
||||
break;
|
||||
case 5:
|
||||
this.humidChange = (float) j / 100;
|
||||
break;
|
||||
case 6: {
|
||||
this.biome = BiomeGenBase.getBiome(j);
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
displayHealth = j;
|
||||
break;
|
||||
case 1:
|
||||
displayHealthMax = j;
|
||||
break;
|
||||
case 4:
|
||||
this.tempChange = (float) j / 100;
|
||||
break;
|
||||
case 5:
|
||||
this.humidChange = (float) j / 100;
|
||||
break;
|
||||
case 6: {
|
||||
this.biome = BiomeGenBase.getBiome(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -803,7 +594,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
|
||||
/* IERRORSOURCE */
|
||||
@Override
|
||||
public EnumErrorCode getErrorState() {
|
||||
public IErrorState getErrorState() {
|
||||
if (hasMaster()) {
|
||||
ITileStructure tile = this.getCentralTE();
|
||||
if (tile != null)
|
||||
@@ -845,7 +636,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
|
||||
public boolean isOwnable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* IHousing */
|
||||
@Override
|
||||
public GameProfile getOwnerName() {
|
||||
|
||||
@@ -12,7 +12,6 @@ package forestry.apiculture.gadgets;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.apiculture.IAlvearyComponent;
|
||||
import forestry.api.apiculture.IBee;
|
||||
@@ -21,9 +20,12 @@ import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.interfaces.ICrafter;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.StackUtils;
|
||||
|
||||
public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListener {
|
||||
|
||||
@@ -33,11 +35,15 @@ public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListe
|
||||
public static final int SLOT_POLLEN_1 = 0;
|
||||
public static final int SLOTS_POLLEN_COUNT = 4;
|
||||
public static final int SLOT_SIEVE = 4;
|
||||
|
||||
private final InventoryAdapter inventory = new InventoryAdapter(5, "Items", 1);
|
||||
|
||||
public TileAlvearySieve() {
|
||||
super(BLOCK_META);
|
||||
setInternalInventory(new TileInventoryAdapter(this, 5, "Items", 1) {
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
return StackUtils.isIdenticalItem(ForestryItem.craftingMaterial.getItemStack(1, 3), itemStack);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,7 +51,6 @@ public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListe
|
||||
player.openGui(ForestryAPI.instance, GuiId.AlvearySieveGUI.ordinal(), worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasFunction() {
|
||||
return true;
|
||||
@@ -62,7 +67,6 @@ public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListe
|
||||
((IAlvearyComponent)getCentralTE()).registerBeeListener(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void updateServerSide() {
|
||||
super.updateServerSide();
|
||||
@@ -75,19 +79,6 @@ public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListe
|
||||
((IAlvearyComponent)getCentralTE()).registerBeeListener(this);
|
||||
}
|
||||
|
||||
/* SAVING & LOADING */
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
inventory.readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
inventory.writeToNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
/* TEXTURES & INTERNAL */
|
||||
@Override
|
||||
public int getIcon(int side, int metadata) {
|
||||
@@ -97,15 +88,19 @@ public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListe
|
||||
}
|
||||
|
||||
private void destroySieve() {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
inventory.setInventorySlotContents(SLOT_SIEVE, null);
|
||||
}
|
||||
|
||||
private void destroyPollen() {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
for(int i = SLOT_POLLEN_1; i < SLOT_POLLEN_1 + SLOTS_POLLEN_COUNT; i++) {
|
||||
inventory.setInventorySlotContents(i, null);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canStorePollen() {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
if(inventory.getStackInSlot(SLOT_SIEVE) == null)
|
||||
return false;
|
||||
|
||||
@@ -118,6 +113,7 @@ public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListe
|
||||
}
|
||||
|
||||
private void storePollenStack(ItemStack itemstack) {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
for(int i = SLOT_POLLEN_1; i < SLOT_POLLEN_1 + SLOTS_POLLEN_COUNT; i++) {
|
||||
if(inventory.getStackInSlot(i) == null) {
|
||||
inventory.setInventorySlotContents(i, itemstack);
|
||||
@@ -125,11 +121,6 @@ public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListe
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* INVENTORY */
|
||||
public InventoryAdapter getInternalInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
/* ICRAFTER */
|
||||
@Override
|
||||
@@ -139,6 +130,7 @@ public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListe
|
||||
|
||||
@Override
|
||||
public ItemStack takenFromSlot(int slotIndex, boolean consumeRecipe, EntityPlayer player) {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
if(slotIndex == SLOT_SIEVE) {
|
||||
destroyPollen();
|
||||
return inventory.getStackInSlot(SLOT_SIEVE);
|
||||
@@ -163,7 +155,7 @@ public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListe
|
||||
public boolean onPollenRetrieved(IBee queen, IIndividual pollen, boolean isHandled) {
|
||||
|
||||
if(isHandled)
|
||||
return isHandled;
|
||||
return true;
|
||||
if(!canStorePollen())
|
||||
return false;
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ public class TileAlvearyStabiliser extends TileAlveary implements IBeeModifier {
|
||||
}
|
||||
|
||||
/* TEXTURES */
|
||||
@Override
|
||||
public int getIcon(int side, int metadata) {
|
||||
if(side == 0 || side == 1)
|
||||
return BlockAlveary.BOTTOM;
|
||||
|
||||
@@ -10,49 +10,48 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Stack;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlvearyComponent;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.ISpecialInventory;
|
||||
import forestry.apiculture.worldgen.Hive;
|
||||
import forestry.apiculture.worldgen.HiveDecorator;
|
||||
import forestry.apiculture.worldgen.HiveSwarmer;
|
||||
import forestry.apiculture.worldgen.HiveDescriptionSwarmer;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.inventory.wrappers.IInvSlot;
|
||||
import forestry.core.inventory.wrappers.InventoryIterator;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Stack;
|
||||
|
||||
public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory {
|
||||
public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory {
|
||||
|
||||
/* CONSTANTS */
|
||||
public static final int BLOCK_META = 2;
|
||||
|
||||
TileInventoryAdapter swarmerInventory;
|
||||
private final Stack<ItemStack> pendingSpawns = new Stack<ItemStack>();
|
||||
private boolean isActive;
|
||||
|
||||
public TileAlvearySwarmer() {
|
||||
super(BLOCK_META);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
super.initialize();
|
||||
if (swarmerInventory == null)
|
||||
createInventory();
|
||||
setInternalInventory(new TileInventoryAdapter(this, 4, "SwarmInv") {
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
return StackUtils.containsItemStack(BeeManager.inducers.keySet(), itemStack);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,9 +68,8 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
setIsActive(true);
|
||||
if (worldObj.getTotalWorldTime() % 1000 == 0)
|
||||
trySpawnSwarm();
|
||||
} else {
|
||||
} else
|
||||
setIsActive(false);
|
||||
}
|
||||
|
||||
if (worldObj.getTotalWorldTime() % 500 != 0)
|
||||
return;
|
||||
@@ -111,14 +109,14 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
}
|
||||
|
||||
private int consumeInducerAndGetChance() {
|
||||
if (swarmerInventory == null)
|
||||
if (getInternalInventory() == null)
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < swarmerInventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = swarmerInventory.getStackInSlot(i);
|
||||
for (IInvSlot slot : InventoryIterator.getIterable(getInternalInventory())) {
|
||||
ItemStack stack = slot.getStackInSlot();
|
||||
for (Entry<ItemStack, Integer> entry : BeeManager.inducers.entrySet()) {
|
||||
if (StackUtils.isIdenticalItem(entry.getKey(), stack)) {
|
||||
swarmerInventory.decrStackSize(i, 1);
|
||||
slot.decreaseStackInSlot();
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
@@ -130,14 +128,14 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
private void trySpawnSwarm() {
|
||||
|
||||
ItemStack toSpawn = pendingSpawns.peek();
|
||||
HiveSwarmer hive = new HiveSwarmer(128, toSpawn);
|
||||
HiveDescriptionSwarmer hiveDescription = new HiveDescriptionSwarmer(toSpawn);
|
||||
Hive hive = new Hive(hiveDescription);
|
||||
|
||||
int chunkX = (xCoord + worldObj.rand.nextInt(40 * 2) - 40) / 16;
|
||||
int chunkZ = (zCoord + worldObj.rand.nextInt(40 * 2) - 40) / 16;
|
||||
|
||||
if (HiveDecorator.instance().genHive(worldObj, worldObj.rand, chunkX, chunkZ, hive)) {
|
||||
if (HiveDecorator.instance().genHive(worldObj, worldObj.rand, chunkX, chunkZ, hive))
|
||||
pendingSpawns.pop();
|
||||
}
|
||||
}
|
||||
|
||||
private void setIsActive(boolean isActive) {
|
||||
@@ -150,9 +148,9 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
/* NETWORK */
|
||||
@Override
|
||||
public void fromPacketPayload(PacketPayload payload) {
|
||||
boolean isActive = payload.shortPayload[0] > 0;
|
||||
if (this.isActive != isActive) {
|
||||
this.isActive = isActive;
|
||||
boolean act = payload.shortPayload[0] > 0;
|
||||
if (this.isActive != act) {
|
||||
this.isActive = act;
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
@@ -172,7 +170,7 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
/* TEXTURES */
|
||||
@Override
|
||||
public int getIcon(int side, int metadata) {
|
||||
if(side == 0 || side == 1)
|
||||
if (side == 0 || side == 1)
|
||||
return BlockAlveary.BOTTOM;
|
||||
|
||||
if (isActive)
|
||||
@@ -185,9 +183,6 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
if (swarmerInventory == null)
|
||||
createInventory();
|
||||
swarmerInventory.readFromNBT(nbttagcompound);
|
||||
|
||||
NBTTagList nbttaglist = nbttagcompound.getTagList("PendingSpawns", 10);
|
||||
for (int i = 0; i < nbttaglist.tagCount(); i++) {
|
||||
@@ -200,126 +195,18 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
if (swarmerInventory != null)
|
||||
swarmerInventory.writeToNBT(nbttagcompound);
|
||||
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
ItemStack[] offspring = pendingSpawns.toArray(new ItemStack[pendingSpawns.size()]);
|
||||
for (int i = 0; i < offspring.length; i++)
|
||||
for (int i = 0; i < offspring.length; i++) {
|
||||
if (offspring[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
offspring[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
nbttagcompound.setTag("PendingSpawns", nbttaglist);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createInventory() {
|
||||
swarmerInventory = new TileInventoryAdapter(this, 4, "SwarmInv");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventory() {
|
||||
return swarmerInventory;
|
||||
}
|
||||
|
||||
/* ISPECIALINVENTORY */
|
||||
@Override
|
||||
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
|
||||
if (swarmerInventory != null)
|
||||
return swarmerInventory.addStack(stack, false, doAdd);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* IINVENTORY */
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
if (swarmerInventory != null)
|
||||
return swarmerInventory.getSizeInventory();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slotIndex) {
|
||||
if (swarmerInventory != null)
|
||||
return swarmerInventory.getStackInSlot(slotIndex);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slotIndex, int amount) {
|
||||
if (swarmerInventory != null)
|
||||
return swarmerInventory.decrStackSize(slotIndex, amount);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slotIndex) {
|
||||
if (swarmerInventory != null)
|
||||
return swarmerInventory.getStackInSlotOnClosing(slotIndex);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slotIndex, ItemStack itemstack) {
|
||||
// Client side handling for container synch
|
||||
if (swarmerInventory == null && !Proxies.common.isSimulating(worldObj))
|
||||
createInventory();
|
||||
|
||||
if (swarmerInventory != null)
|
||||
swarmerInventory.setInventorySlotContents(slotIndex, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
if (swarmerInventory != null)
|
||||
return swarmerInventory.getInventoryStackLimit();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override public void openInventory() {}
|
||||
@Override public void closeInventory() {}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return super.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return super.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||
return super.isItemValidForSlot(slotIndex, itemstack);
|
||||
}
|
||||
}
|
||||
@@ -10,29 +10,31 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.apiculture.trigger.ApicultureTriggers;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
|
||||
public class TileApiary extends TileBeehouse implements ISidedInventory {
|
||||
public class TileApiary extends TileBeehouse {
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return getUnlocalizedName();
|
||||
public TileApiary() {
|
||||
setInternalInventory(new BeehouseInventoryAdapter(this, 12, "Items"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,6 +45,7 @@ public class TileApiary extends TileBeehouse implements ISidedInventory {
|
||||
/* IBEEHOUSING */
|
||||
@Override
|
||||
public float getTerritoryModifier(IBeeGenome genome, float currentModifier) {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
float mod = 1.0f;
|
||||
for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
|
||||
if (inventory.getStackInSlot(i) == null)
|
||||
@@ -55,6 +58,7 @@ public class TileApiary extends TileBeehouse implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
float mod = 0.1f;
|
||||
for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
|
||||
if (inventory.getStackInSlot(i) == null)
|
||||
@@ -67,6 +71,7 @@ public class TileApiary extends TileBeehouse implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
float mod = 1.0f;
|
||||
for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
|
||||
if (inventory.getStackInSlot(i) == null)
|
||||
@@ -79,6 +84,7 @@ public class TileApiary extends TileBeehouse implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
float mod = 1.0f;
|
||||
for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
|
||||
if (inventory.getStackInSlot(i) == null)
|
||||
@@ -91,6 +97,7 @@ public class TileApiary extends TileBeehouse implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(IBeeGenome genome, float currentModifier) {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
float mod = 1f;
|
||||
for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
|
||||
if (inventory.getStackInSlot(i) == null)
|
||||
@@ -103,6 +110,7 @@ public class TileApiary extends TileBeehouse implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(IBeeGenome genome, float currentModifier) {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
float mod = 1f;
|
||||
for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
|
||||
if (inventory.getStackInSlot(i) == null)
|
||||
@@ -115,6 +123,7 @@ public class TileApiary extends TileBeehouse implements ISidedInventory {
|
||||
|
||||
@Override
|
||||
public void wearOutEquipment(int amount) {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
int wear = Math.round(amount * PluginApiculture.beeInterface.getBeekeepingMode(worldObj).getWearModifier());
|
||||
|
||||
for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
|
||||
@@ -130,128 +139,6 @@ public class TileApiary extends TileBeehouse implements ISidedInventory {
|
||||
}
|
||||
}
|
||||
|
||||
/* IINVENTORY */
|
||||
@Override
|
||||
protected boolean canTakeStackFromSide(int slotIndex, ItemStack itemstack, int side) {
|
||||
if (!super.canTakeStackFromSide(slotIndex, itemstack, side))
|
||||
return false;
|
||||
|
||||
switch (slotIndex) {
|
||||
case SLOT_QUEEN:
|
||||
case SLOT_DRONE:
|
||||
case SLOT_FRAMES_1:
|
||||
case SLOT_FRAMES_2:
|
||||
case SLOT_FRAMES_3:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canPutStackFromSide(int slotIndex, ItemStack itemstack, int side) {
|
||||
if (!super.canPutStackFromSide(slotIndex, itemstack, side))
|
||||
return false;
|
||||
|
||||
if (slotIndex == SLOT_QUEEN && PluginApiculture.beeInterface.isMember(itemstack)
|
||||
&& !PluginApiculture.beeInterface.isDrone(itemstack))
|
||||
return true;
|
||||
|
||||
if (slotIndex == SLOT_DRONE && PluginApiculture.beeInterface.isDrone(itemstack))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return super.getStackInSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
super.setSlotContents(i, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
return inventory.decrStackSize(i, j);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return super.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return super.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||
return super.isItemValidForSlot(slotIndex, itemstack);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
return super.canInsertItem(i, itemstack, j);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return super.canExtractItem(i, itemstack, j);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
*/
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return super.getAccessibleSlotsFromSide(side);
|
||||
}
|
||||
|
||||
/* ISPECIALINVENTORY */
|
||||
// @Override
|
||||
// public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {
|
||||
|
||||
@@ -10,28 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.interfaces.IClimatised;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.PacketIds;
|
||||
import forestry.core.network.PacketInventoryStack;
|
||||
import forestry.core.network.PacketTileUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
@@ -40,22 +18,69 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.gadgets.TileForestry;
|
||||
import forestry.core.interfaces.IClimatised;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.InvTools;
|
||||
import forestry.core.inventory.TileInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.PacketIds;
|
||||
import forestry.core.network.PacketInventoryStack;
|
||||
import forestry.core.network.PacketTileUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.GuiUtil;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
|
||||
protected static class BeehouseInventoryAdapter extends TileInventoryAdapter {
|
||||
public BeehouseInventoryAdapter(TileForestry tile, int size, String name) {
|
||||
super(tile, size, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == SLOT_QUEEN) {
|
||||
return PluginApiculture.beeInterface.isMember(itemStack) && !PluginApiculture.beeInterface.isDrone(itemStack);
|
||||
} else if (GuiUtil.isIndexInRange(slotIndex, SLOT_FRAMES_1, SLOT_FRAMES_COUNT)) {
|
||||
return itemStack.getItem() instanceof IHiveFrame;
|
||||
} else if (slotIndex == SLOT_DRONE) {
|
||||
return PluginApiculture.beeInterface.isDrone(itemStack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
return GuiUtil.isIndexInRange(slotIndex, SLOT_PRODUCT_1, SLOT_PRODUCT_COUNT);
|
||||
}
|
||||
}
|
||||
|
||||
// CONSTANTS
|
||||
public static final int SLOT_QUEEN = 0;
|
||||
public static final int SLOT_DRONE = 1;
|
||||
public static final int SLOT_INVENTORY_1 = 2;
|
||||
public static final int SLOT_PRODUCT_1 = 2;
|
||||
public static final int SLOT_PRODUCT_COUNT = 7;
|
||||
public static final int SLOT_FRAMES_1 = 9;
|
||||
public static final int SLOT_FRAMES_2 = 10;
|
||||
public static final int SLOT_FRAMES_3 = 11;
|
||||
public static final int SLOT_INVENTORY_COUNT = 7;
|
||||
public static final int SLOT_FRAMES_COUNT = 3;
|
||||
|
||||
// Inventory
|
||||
protected final InventoryAdapter inventory = new InventoryAdapter(12, "Items");
|
||||
private final IBeekeepingLogic logic;
|
||||
private BiomeGenBase biome;
|
||||
private int displayHealthMax = 0;
|
||||
@@ -64,6 +89,7 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
public TileBeehouse() {
|
||||
setHints(Config.hints.get("apiary"));
|
||||
logic = PluginApiculture.beeInterface.createBeekeepingLogic(this);
|
||||
setInternalInventory(new BeehouseInventoryAdapter(this, 12, "Items").disableAutomation());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,8 +103,6 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
|
||||
nbttagcompound.setInteger("BiomeId", biome.biomeID);
|
||||
|
||||
inventory.writeToNBT(nbttagcompound);
|
||||
if (logic != null)
|
||||
logic.writeToNBT(nbttagcompound);
|
||||
}
|
||||
@@ -89,8 +113,6 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
|
||||
int biomeId = nbttagcompound.getInteger("BiomeId");
|
||||
biome = BiomeGenBase.getBiome(biomeId);
|
||||
|
||||
inventory.readFromNBT(nbttagcompound);
|
||||
logic.readFromNBT(nbttagcompound);
|
||||
|
||||
}
|
||||
@@ -114,7 +136,7 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
return EnumTemperature.getFromValue(getExactTemperature());
|
||||
return EnumTemperature.getFromBiome(biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,12 +159,11 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
public void updateClientSide() {
|
||||
|
||||
// / Multiplayer FX
|
||||
if (PluginApiculture.beeInterface.isMated(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
if (PluginApiculture.beeInterface.isMated(getInternalInventory().getStackInSlot(SLOT_QUEEN)))
|
||||
if (getErrorState() == EnumErrorCode.OK && worldObj.getTotalWorldTime() % 2 % 2 == 0) {
|
||||
IBee displayQueen = PluginApiculture.beeInterface.getMember(inventory.getStackInSlot(SLOT_QUEEN));
|
||||
IBee displayQueen = PluginApiculture.beeInterface.getMember(getInternalInventory().getStackInSlot(SLOT_QUEEN));
|
||||
displayQueen.doFX(logic.getEffectData(), this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -157,7 +178,7 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
|
||||
// Add swarm effects
|
||||
if (worldObj.getTotalWorldTime() % 200 * 10 == 0)
|
||||
onQueenChange(inventory.getStackInSlot(SLOT_QUEEN));
|
||||
onQueenChange(getInternalInventory().getStackInSlot(SLOT_QUEEN));
|
||||
/* These should get already done on the client / doesn't work server-side anyway
|
||||
if (getErrorState() == EnumErrorCode.OK && worldObj.getTotalWorldTime() % 2 % 2 == 0)
|
||||
queen.doFX(logic.getEffectData(), this);
|
||||
@@ -184,7 +205,7 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
|
||||
@Override
|
||||
public boolean addProduct(ItemStack product, boolean all) {
|
||||
return inventory.tryAddStack(product, SLOT_PRODUCT_1, SLOT_PRODUCT_COUNT, all, true);
|
||||
return InvTools.tryAddStack(getInternalInventory(), product, SLOT_PRODUCT_1, SLOT_PRODUCT_COUNT, all, true);
|
||||
}
|
||||
|
||||
/* NETWORK SYNCH */
|
||||
@@ -200,6 +221,7 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
|
||||
/* STATE INFORMATION */
|
||||
private int getHealthDisplay() {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
if (inventory.getStackInSlot(SLOT_QUEEN) == null)
|
||||
return 0;
|
||||
|
||||
@@ -212,6 +234,7 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
}
|
||||
|
||||
private int getMaxHealthDisplay() {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
if (inventory.getStackInSlot(SLOT_QUEEN) == null)
|
||||
return 0;
|
||||
|
||||
@@ -225,9 +248,6 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
|
||||
/**
|
||||
* Returns scaled queen health or breeding progress
|
||||
*
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
public int getHealthScaled(int i) {
|
||||
if (getMaxHealthDisplay() == 0)
|
||||
@@ -279,20 +299,6 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
iCrafting.sendProgressBarUpdate(container, 1, logic.getTotalBreedingTime());
|
||||
}
|
||||
|
||||
/* INVENTORY MANAGMENT */
|
||||
@Override
|
||||
public InventoryAdapter getInternalInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return inventory.getStackInSlot(i);
|
||||
}
|
||||
|
||||
public void setSlotContents(int i, ItemStack itemstack) {
|
||||
inventory.setInventorySlotContents(i, itemstack);
|
||||
}
|
||||
|
||||
// / IBEEHOUSING
|
||||
@Override
|
||||
public int getXCoord() {
|
||||
@@ -331,12 +337,12 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
|
||||
@Override
|
||||
public void setQueen(ItemStack itemstack) {
|
||||
setSlotContents(SLOT_QUEEN, itemstack);
|
||||
setInventorySlotContents(SLOT_QUEEN, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDrone(ItemStack itemstack) {
|
||||
setSlotContents(SLOT_DRONE, itemstack);
|
||||
setInventorySlotContents(SLOT_DRONE, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -351,7 +357,7 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
|
||||
@Override
|
||||
public int getErrorOrdinal() {
|
||||
return getErrorState().ordinal();
|
||||
return getErrorState().getID();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -430,7 +436,7 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
public boolean onEggLaid(IBee queen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* IHousing */
|
||||
@Override
|
||||
public GameProfile getOwnerName() {
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import forestry.core.inventory.InvTools;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
|
||||
public class TileSwarm extends TileEntity {
|
||||
|
||||
@@ -22,12 +23,26 @@ public class TileSwarm extends TileEntity {
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Hack to make sure that hives glow.
|
||||
// TODO: remove when Mojang fixes this bug: https://bugs.mojang.com/browse/MC-3329
|
||||
// Hives should not need to tick normally.
|
||||
private boolean updatedLight;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (worldObj.isRemote && !updatedLight && worldObj.getWorldTime() % 20 == 0) {
|
||||
updatedLight = worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public TileSwarm setContained(ItemStack[] bees) {
|
||||
for (ItemStack itemstack : bees)
|
||||
contained.addStack(itemstack, false, true);
|
||||
InvTools.addStack(contained, itemstack, false, true);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -29,15 +29,14 @@ import forestry.core.config.Defaults;
|
||||
import forestry.core.genetics.AlleleSpecies;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies, IIconProvider {
|
||||
|
||||
@@ -52,7 +51,7 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
private final int primaryColour;
|
||||
private final int secondaryColour;
|
||||
|
||||
private final String iconType = "default";
|
||||
private static final String iconType = "default";
|
||||
|
||||
public AlleleBeeSpecies(String uid, boolean dominant, String name, IClassification branch, int primaryColor, int secondaryColor) {
|
||||
this(uid, dominant, name, branch, null, primaryColor, secondaryColor);
|
||||
@@ -112,7 +111,7 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
int highest = 0;
|
||||
exclude.add(species);
|
||||
|
||||
for(IMutation mutation : getRoot().getPaths(species, EnumBeeChromosome.SPECIES.ordinal())) {
|
||||
for(IMutation mutation : getRoot().getPaths(species, EnumBeeChromosome.SPECIES)) {
|
||||
if(!exclude.contains(mutation.getAllele0())) {
|
||||
int otherAdvance = getGeneticAdvancement(mutation.getAllele0(), exclude);
|
||||
if(otherAdvance > highest)
|
||||
|
||||
@@ -10,18 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
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.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.apiculture.items.ItemArmorApiarist;
|
||||
import forestry.core.utils.DamageSourceForestry;
|
||||
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;
|
||||
|
||||
public class AlleleEffectAggressive extends AlleleEffectThrottled {
|
||||
|
||||
|
||||
@@ -10,22 +10,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.apiculture.items.ItemArmorApiarist;
|
||||
import forestry.core.genetics.EffectData;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class AlleleEffectCreeper extends AlleleEffectThrottled {
|
||||
|
||||
private final int explosionChance = 50;
|
||||
private final byte defaultForce = 12;
|
||||
private static final int explosionChance = 50;
|
||||
private static final byte defaultForce = 12;
|
||||
private final byte indexExplosionTimer = 1;
|
||||
private final byte indexExplosionForce = 2;
|
||||
|
||||
|
||||
@@ -10,14 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
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;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class AlleleEffectExploration extends AlleleEffectThrottled {
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class AlleleEffectFertile extends AlleleEffectThrottled {
|
||||
|
||||
public static final int MAX_BLOCK_FIND_TRIES = 5;
|
||||
|
||||
public AlleleEffectFertile(String uid) {
|
||||
super(uid, "fertile", false, 6, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
|
||||
if (isHalted(storedData, housing)) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
World world = housing.getWorld();
|
||||
int territorySize[] = getModifiedArea(genome, housing);
|
||||
|
||||
int blockX = getRandomOffset(world.rand, housing.getXCoord(), territorySize[0]);
|
||||
int blockZ = getRandomOffset(world.rand, housing.getZCoord(), territorySize[2]);
|
||||
int blockMaxY = housing.getYCoord() + territorySize[1] / 2 + 1;
|
||||
int blockMinY = housing.getYCoord() - (territorySize[1] / 2) - 1;
|
||||
|
||||
for (int attempt = 0; attempt < MAX_BLOCK_FIND_TRIES; ++attempt) {
|
||||
if (tryTickColumn(world, blockX, blockZ, blockMaxY, blockMinY)) {
|
||||
break;
|
||||
}
|
||||
blockX = getRandomOffset(world.rand, housing.getXCoord(), territorySize[0]);
|
||||
blockZ = getRandomOffset(world.rand, housing.getZCoord(), territorySize[2]);
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
|
||||
private int getRandomOffset(Random random, int centrePos, int offset) {
|
||||
return centrePos + random.nextInt(offset) - (offset / 2);
|
||||
}
|
||||
|
||||
private 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);
|
||||
world.scheduleBlockUpdate(x, y, z, block, 5);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.genetics.EffectData;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
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.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenBigMushroom;
|
||||
|
||||
public class AlleleEffectFungification extends AlleleEffectThrottled {
|
||||
|
||||
public static final int MAX_BLOCK_FIND_TRIES = 10;
|
||||
public static final int ENTITY_THROTTLE = 6;
|
||||
|
||||
public AlleleEffectFungification(String uid) {
|
||||
super(uid, "mycophilic", true, 10, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
if (storedData instanceof EffectData && ((EffectData) storedData).getIntSize() == 2) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
return new EffectData(2, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
if (isHalted(storedData, housing)) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
doBlockEffect(genome, housing);
|
||||
|
||||
int entityThrottle = storedData.getInteger(1);
|
||||
if (entityThrottle >= ENTITY_THROTTLE) {
|
||||
doEntityEffect(genome, housing);
|
||||
entityThrottle = 0;
|
||||
} else {
|
||||
++entityThrottle;
|
||||
}
|
||||
storedData.setInteger(1, entityThrottle);
|
||||
|
||||
return storedData;
|
||||
}
|
||||
|
||||
private void doBlockEffect(IBeeGenome genome, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
int territorySize[] = getModifiedArea(genome, housing);
|
||||
|
||||
int blockX = getRandomOffset(world.rand, housing.getXCoord(), territorySize[0]);
|
||||
int blockY = getRandomOffset(world.rand, housing.getYCoord(), territorySize[1]);
|
||||
int blockZ = getRandomOffset(world.rand, housing.getZCoord(), territorySize[2]);
|
||||
|
||||
for (int attempt = 0; attempt < MAX_BLOCK_FIND_TRIES; ++attempt) {
|
||||
Block block = world.getBlock(blockX, blockY, blockZ);
|
||||
if (isSuitableForMycelium(world, block, blockX, blockY, blockZ)) {
|
||||
world.setBlock(blockX, blockY, blockZ, Blocks.mycelium);
|
||||
break;
|
||||
} else if (isSuitableForGrowth(block)) {
|
||||
doMushroomGrowth(block, world, blockX, blockY, blockZ);
|
||||
break;
|
||||
}
|
||||
blockX = getRandomOffset(world.rand, housing.getXCoord(), territorySize[0]);
|
||||
blockY = getRandomOffset(world.rand, housing.getYCoord(), territorySize[1]);
|
||||
blockZ = getRandomOffset(world.rand, housing.getZCoord(), territorySize[2]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void doEntityEffect(IBeeGenome genome, IBeeHousing housing) {
|
||||
AxisAlignedBB aabb = this.getBounding(genome, housing, 1f);
|
||||
World world = housing.getWorld();
|
||||
@SuppressWarnings("unchecked") // Quiets warnings. Eventually returns a list of entities.
|
||||
List<Entity> entities = (List<Entity>)world.getEntitiesWithinAABB(EntityCow.class, aabb);
|
||||
for (Entity entity : entities) {
|
||||
if (entity instanceof EntityCow && !(entity instanceof EntityMooshroom)) {
|
||||
convertCowToMooshroom((EntityCow)entity);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getRandomOffset(Random random, int centrePos, int offset) {
|
||||
return centrePos + random.nextInt(offset) - (offset / 2);
|
||||
}
|
||||
|
||||
private boolean isSuitableForMycelium(World world, Block block, int blockX, int blockY, int blockZ) {
|
||||
return block == Blocks.grass || (block == Blocks.dirt && world.canBlockSeeTheSky(blockX, blockY, blockZ));
|
||||
}
|
||||
|
||||
private boolean isSuitableForGrowth(Block block) {
|
||||
return block == Blocks.red_mushroom || block == Blocks.brown_mushroom;
|
||||
}
|
||||
|
||||
private static void convertCowToMooshroom(EntityCow cow) {
|
||||
World worldObj = cow.worldObj;
|
||||
cow.setDead();
|
||||
EntityMooshroom mooshroom = new EntityMooshroom(worldObj);
|
||||
mooshroom.setLocationAndAngles(cow.posX, cow.posY, cow.posZ, cow.rotationYaw, cow.rotationPitch);
|
||||
mooshroom.setHealth(cow.getHealth());
|
||||
mooshroom.renderYawOffset = cow.renderYawOffset;
|
||||
worldObj.spawnEntityInWorld(mooshroom);
|
||||
worldObj.spawnParticle("largeexplode", cow.posX, cow.posY + (double)(cow.height / 2.0F), cow.posZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
private void doMushroomGrowth(Block block, World world, int blockX, int blockY, int blockZ) {
|
||||
WorldGenBigMushroom giantMushroomGenerator;
|
||||
|
||||
if (block == Blocks.brown_mushroom) {
|
||||
giantMushroomGenerator = new WorldGenBigMushroom(0);
|
||||
} else {
|
||||
giantMushroomGenerator = new WorldGenBigMushroom(1);
|
||||
}
|
||||
|
||||
world.setBlockToAir(blockX, blockY, blockZ);
|
||||
giantMushroomGenerator.generate(world, world.rand, blockX, blockY, blockZ);
|
||||
}
|
||||
}
|
||||
@@ -10,17 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
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.utils.Vect;
|
||||
import forestry.core.vect.Vect;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class AlleleEffectGlacial extends AlleleEffectThrottled {
|
||||
|
||||
|
||||
@@ -10,15 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
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 java.util.List;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
public class AlleleEffectHeroic extends AlleleEffectThrottled {
|
||||
|
||||
|
||||
@@ -10,23 +10,21 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.apiculture.items.ItemArmorApiarist;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class AlleleEffectIgnition extends AlleleEffectThrottled {
|
||||
|
||||
private final int ignitionChance = 50;
|
||||
private final int fireDuration = 500;
|
||||
private static final int ignitionChance = 50;
|
||||
private static final int fireDuration = 500;
|
||||
|
||||
public AlleleEffectIgnition(String uid) {
|
||||
super(uid, "ignition", false, 20, false, true);
|
||||
|
||||
@@ -10,23 +10,21 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.apiculture.items.ItemArmorApiarist;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.apiculture.items.ItemArmorApiarist;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class AlleleEffectMiasmic extends AlleleEffectThrottled {
|
||||
|
||||
private final int infectionChance = 50;
|
||||
private static final int infectionChance = 50;
|
||||
|
||||
public AlleleEffectMiasmic(String uid) {
|
||||
super(uid, "misasmic", false, 50, false, false);
|
||||
|
||||
@@ -10,17 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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.apiculture.items.ItemArmorApiarist;
|
||||
import forestry.core.utils.DamageSourceForestry;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
public class AlleleEffectMisanthrope extends AlleleEffectThrottled {
|
||||
|
||||
|
||||
@@ -10,14 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class AlleleEffectNone extends Allele implements IAlleleBeeEffect {
|
||||
|
||||
|
||||
@@ -10,25 +10,28 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.apiculture.items.ItemArmorApiarist;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
public class AlleleEffectPotion extends AlleleEffectThrottled {
|
||||
|
||||
private int potionId = 0;
|
||||
private final Potion potion;
|
||||
private final boolean isBadEffect;
|
||||
private final int duration;
|
||||
|
||||
public AlleleEffectPotion(String uid, String name, boolean isDominant, Potion potion, int duration, boolean requiresWorking) {
|
||||
super(uid, name, isDominant, 200, requiresWorking, false);
|
||||
potionId = potion.getId();
|
||||
this.potion = potion;
|
||||
this.isBadEffect = isBadEffect(potion);
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
@@ -39,15 +42,42 @@ public class AlleleEffectPotion extends AlleleEffectThrottled {
|
||||
return storedData;
|
||||
|
||||
AxisAlignedBB beatifyBox = getBounding(genome, housing, 1.0f);
|
||||
@SuppressWarnings("rawtypes")
|
||||
List list = housing.getWorld().getEntitiesWithinAABB(EntityPlayer.class, beatifyBox);
|
||||
|
||||
for (Object obj : list) {
|
||||
EntityPlayer player = (EntityPlayer) obj;
|
||||
player.addPotionEffect(new PotionEffect(potionId, duration, 0));
|
||||
for (Object entity : list) {
|
||||
if (!(entity instanceof EntityPlayer))
|
||||
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 = ItemArmorApiarist.wearsItems((EntityPlayer) entity, getUID(), true);
|
||||
if (count >= 4)
|
||||
continue; // Full set, no damage/effect
|
||||
else if (count == 3)
|
||||
dur = this.duration / 4;
|
||||
else if (count == 2)
|
||||
dur = this.duration / 2;
|
||||
else if (count == 1)
|
||||
dur = this.duration * 3 / 4;
|
||||
}
|
||||
|
||||
player.addPotionEffect(new PotionEffect(potion.getId(), dur, 0));
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
|
||||
//FIXME: remove when Potion.isBadEffect() is available server-side
|
||||
private static boolean isBadEffect(Potion potion) {
|
||||
try {
|
||||
return (Boolean) ReflectionHelper.getPrivateValue(Potion.class, potion, "field_76418_K", "isBadEffect");
|
||||
} catch (ReflectionHelper.UnableToFindFieldException e) {
|
||||
Proxies.log.severe("Could not access potion field isBadEffect.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,17 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.List;
|
||||
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;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
@@ -28,7 +17,16 @@ import forestry.apiculture.gadgets.BlockAlveary;
|
||||
import forestry.apiculture.gadgets.TileAlveary;
|
||||
import forestry.apiculture.items.ItemArmorApiarist;
|
||||
import forestry.core.utils.DamageSourceForestry;
|
||||
import forestry.core.utils.Vect;
|
||||
import forestry.core.vect.Vect;
|
||||
import java.util.List;
|
||||
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;
|
||||
|
||||
public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
|
||||
|
||||
@@ -10,15 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
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;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.ai.EntityAITasks.EntityAITaskEntry;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class AlleleEffectRepulsion extends AlleleEffectThrottled {
|
||||
|
||||
|
||||
@@ -10,10 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -30,12 +34,6 @@ 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;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
public class AlleleEffectResurrection extends AlleleEffectThrottled {
|
||||
|
||||
public static class Resurrectable {
|
||||
|
||||
@@ -10,18 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
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.utils.Vect;
|
||||
import forestry.core.vect.Vect;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class AlleleEffectSnowing extends AlleleEffectThrottled {
|
||||
|
||||
|
||||
@@ -10,17 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.EffectData;
|
||||
import forestry.core.utils.Vect;
|
||||
import forestry.core.vect.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public abstract class AlleleEffectThrottled extends Allele implements IAlleleBeeEffect {
|
||||
|
||||
@@ -55,14 +54,14 @@ public abstract class AlleleEffectThrottled extends Allele implements IAlleleBee
|
||||
|
||||
public boolean isHalted(IEffectData storedData, IBeeHousing housing) {
|
||||
|
||||
if (requiresWorkingQueen && housing.getErrorOrdinal() != EnumErrorCode.OK.ordinal())
|
||||
if (requiresWorkingQueen && housing.getErrorState() != EnumErrorCode.OK)
|
||||
return true;
|
||||
|
||||
int throttle = storedData.getInteger(0);
|
||||
throttle++;
|
||||
storedData.setInteger(0, throttle);
|
||||
int throt = storedData.getInteger(0);
|
||||
throt++;
|
||||
storedData.setInteger(0, throt);
|
||||
|
||||
if (throttle < getThrottle())
|
||||
if (throt < getThrottle())
|
||||
return true;
|
||||
|
||||
// Reset since we are done throttling.
|
||||
|
||||
@@ -10,16 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.genetics.BreedingTracker;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ApiaristTracker extends BreedingTracker implements IApiaristTracker {
|
||||
|
||||
@@ -61,7 +60,7 @@ public class ApiaristTracker extends BreedingTracker implements IApiaristTracker
|
||||
public void registerPickup(IIndividual individual) {
|
||||
if(!individual.getGenome().getPrimary().getRoot().getUID().equals(BeeHelper.UID))
|
||||
return;
|
||||
if(!individual.isPureBred(0))
|
||||
if(!individual.isPureBred(EnumBeeChromosome.SPECIES))
|
||||
return;
|
||||
if(PluginApiculture.beeInterface.getCombinations(individual.getGenome().getPrimary()).size() > 0)
|
||||
return;
|
||||
|
||||
@@ -10,6 +10,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
@@ -20,7 +34,6 @@ import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumErrorCode;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
@@ -32,29 +45,23 @@ import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.genetics.Chromosome;
|
||||
import forestry.core.genetics.GenericRatings;
|
||||
import forestry.core.genetics.IndividualLiving;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.GeneticsUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.core.utils.Vect;
|
||||
import forestry.core.vect.MutableVect;
|
||||
import forestry.core.vect.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
protected int generation;
|
||||
protected boolean isNatural = true;
|
||||
|
||||
public IBeeGenome genome;
|
||||
public IBeeGenome mate;
|
||||
|
||||
@@ -63,28 +70,20 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
public Bee(World world, IBeeGenome genome, IBee mate) {
|
||||
this(world, genome);
|
||||
public Bee(IBeeGenome genome, IBee mate) {
|
||||
this(genome);
|
||||
this.mate = mate.getGenome();
|
||||
this.isIrregularMating = mate.isNatural() != this.isNatural;
|
||||
}
|
||||
|
||||
public Bee(World world, IBeeGenome genome) {
|
||||
this(world, genome, true, 0);
|
||||
}
|
||||
|
||||
public Bee(IBeeGenome genome) {
|
||||
this(genome, true, 0);
|
||||
}
|
||||
|
||||
public Bee(World world, IBeeGenome genome, boolean isNatural, int generation) {
|
||||
super(genome.getLifespan(), isNatural, generation);
|
||||
this.genome = genome;
|
||||
}
|
||||
|
||||
public Bee(IBeeGenome genome, boolean isNatural, int generation) {
|
||||
super(genome.getLifespan(), isNatural, generation);
|
||||
super(genome.getLifespan());
|
||||
this.genome = genome;
|
||||
this.isNatural = isNatural;
|
||||
this.generation = generation;
|
||||
}
|
||||
|
||||
/* SAVING & LOADING */
|
||||
@@ -98,15 +97,51 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
super.readFromNBT(nbttagcompound);
|
||||
|
||||
if (nbttagcompound.hasKey("NA"))
|
||||
isNatural = nbttagcompound.getBoolean("NA");
|
||||
|
||||
if (nbttagcompound.hasKey("GEN"))
|
||||
generation = nbttagcompound.getInteger("GEN");
|
||||
|
||||
if (nbttagcompound.hasKey("Genome"))
|
||||
genome = new BeeGenome(nbttagcompound.getCompoundTag("Genome"));
|
||||
else
|
||||
genome = PluginApiculture.beeInterface.templateAsGenome(BeeTemplates.getForestTemplate());
|
||||
|
||||
if (nbttagcompound.hasKey("Mate"))
|
||||
mate = new BeeGenome(nbttagcompound.getCompoundTag("Mate"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
|
||||
super.writeToNBT(nbttagcompound);
|
||||
|
||||
if (!isNatural)
|
||||
nbttagcompound.setBoolean("NA", false);
|
||||
|
||||
if (generation > 0)
|
||||
nbttagcompound.setInteger("GEN", generation);
|
||||
}
|
||||
|
||||
public void setIsNatural(boolean flag) {
|
||||
this.isNatural = flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIrregularMating() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isNatural() {
|
||||
return this.isNatural;
|
||||
}
|
||||
|
||||
public int getGeneration() {
|
||||
return generation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mate(IIndividual individual) {
|
||||
if(!(individual instanceof IBee))
|
||||
@@ -114,7 +149,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
IBee drone = (IBee)individual;
|
||||
mate = drone.getGenome();
|
||||
this.isIrregularMating = drone.isNatural() != this.isNatural;
|
||||
}
|
||||
|
||||
/* EFFECTS */
|
||||
@@ -131,7 +165,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
if (!effect.isCombinable())
|
||||
return storedData;
|
||||
|
||||
IAlleleBeeEffect secondary = (IAlleleBeeEffect) genome.getInactiveAllele(EnumBeeChromosome.EFFECT.ordinal());
|
||||
IAlleleBeeEffect secondary = (IAlleleBeeEffect) genome.getInactiveAllele(EnumBeeChromosome.EFFECT);
|
||||
if (!secondary.isCombinable())
|
||||
return storedData;
|
||||
|
||||
@@ -158,7 +192,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
if (!effect.isCombinable())
|
||||
return storedData;
|
||||
|
||||
IAlleleBeeEffect secondary = (IAlleleBeeEffect) genome.getInactiveAllele(EnumBeeChromosome.EFFECT.ordinal());
|
||||
IAlleleBeeEffect secondary = (IAlleleBeeEffect) genome.getInactiveAllele(EnumBeeChromosome.EFFECT);
|
||||
if (!secondary.isCombinable())
|
||||
return storedData;
|
||||
|
||||
@@ -246,8 +280,10 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
private boolean checkBiomeHazard(BiomeGenBase biome) {
|
||||
if (biome == null)
|
||||
return false;
|
||||
|
||||
EnumTemperature temperature = EnumTemperature.getFromValue(biome.temperature);
|
||||
EnumTemperature temperature = EnumTemperature.getFromBiome(biome);
|
||||
EnumHumidity humidity = EnumHumidity.getFromValue(biome.rainfall);
|
||||
return AlleleManager.climateHelper.isWithinLimits(temperature, humidity,
|
||||
genome.getPrimary().getTemperature(), genome.getToleranceTemp(),
|
||||
@@ -266,26 +302,16 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
IFlowerProvider provider = genome.getFlowerProvider();
|
||||
|
||||
Vect coords = new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord());
|
||||
Vect posCurrent = new Vect(0, 0, 0);
|
||||
int[] areaAr = genome.getTerritory();
|
||||
Vect area = new Vect(areaAr[0], areaAr[1], areaAr[2]).multiply(housing.getTerritoryModifier(genome, 1f));
|
||||
|
||||
if (area.x < 1)
|
||||
area.x = 1;
|
||||
if (area.y < 1)
|
||||
area.y = 1;
|
||||
if (area.z < 1)
|
||||
area.z = 1;
|
||||
|
||||
Vect offset = new Vect(-Math.round(area.x / 2), -Math.round(area.y / 2), -Math.round(area.z / 2));
|
||||
Vect housingPos = new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord());
|
||||
Vect area = getArea(genome, housing);
|
||||
Vect offset = new Vect(-area.x / 2, -area.y / 2, -area.z / 2);
|
||||
|
||||
boolean hasFlower = false;
|
||||
|
||||
while (advancePosition(posCurrent, area)) {
|
||||
MutableVect posCurrent = new MutableVect(0, 0, 0);
|
||||
while (posCurrent.advancePositionInArea(area)) {
|
||||
|
||||
Vect posBlock = posCurrent.add(coords);
|
||||
posBlock = posBlock.add(offset);
|
||||
Vect posBlock = Vect.add(housingPos, posCurrent, offset);
|
||||
|
||||
if (provider.isAcceptedFlower(housing.getWorld(), this, posBlock.x, posBlock.y, posBlock.z)) {
|
||||
hasFlower = true;
|
||||
@@ -297,28 +323,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return hasFlower;
|
||||
}
|
||||
|
||||
private boolean advancePosition(Vect posCurrent, Vect area) {
|
||||
// Increment z first until end reached
|
||||
if (posCurrent.z < area.z - 1)
|
||||
posCurrent.z++;
|
||||
else {
|
||||
posCurrent.z = 0;
|
||||
|
||||
if (posCurrent.x < area.x - 1)
|
||||
posCurrent.x++;
|
||||
else {
|
||||
posCurrent.x = 0;
|
||||
|
||||
if (posCurrent.y < area.y - 1)
|
||||
posCurrent.y++;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Integer> getSuitableBiomeIds() {
|
||||
ArrayList<Integer> suitableBiomes = new ArrayList<Integer>();
|
||||
@@ -351,27 +355,48 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
// You analyzed it? Juicy tooltip coming up!
|
||||
IAlleleBeeSpecies primary = genome.getPrimary();
|
||||
IAlleleBeeSpecies secondary = genome.getSecondary();
|
||||
if (!isPureBred(EnumBeeChromosome.SPECIES.ordinal()))
|
||||
list.add("\u00A79" + StringUtil.localize("bees.hybrid").replaceAll("%PRIMARY",primary.getName()).replaceAll("%SECONDARY",secondary.getName()));
|
||||
if (!isPureBred(EnumBeeChromosome.SPECIES))
|
||||
list.add(EnumChatFormatting.BLUE + StringUtil.localize("bees.hybrid").replaceAll("%PRIMARY",primary.getName()).replaceAll("%SECONDARY",secondary.getName()));
|
||||
|
||||
IAllele speed = genome.getActiveAllele(EnumBeeChromosome.SPEED.ordinal());
|
||||
String customWorker = "tooltip.worker." + speed.getUnlocalizedName().replaceFirst("gui.", "");
|
||||
if (StringUtil.canTranslate(customWorker))
|
||||
list.add(StringUtil.localize(customWorker));
|
||||
if (generation > 0) {
|
||||
EnumRarity rarity;
|
||||
if (generation >= 1000)
|
||||
rarity = EnumRarity.epic;
|
||||
else if (generation >= 100)
|
||||
rarity = EnumRarity.rare;
|
||||
else if (generation >= 10)
|
||||
rarity = EnumRarity.uncommon;
|
||||
else
|
||||
rarity = EnumRarity.common;
|
||||
|
||||
String generationString = rarity.rarityColor + StringUtil.localizeAndFormat("gui.beealyzer.generations", generation);
|
||||
list.add(generationString);
|
||||
}
|
||||
|
||||
IAllele speedAllele = genome.getActiveAllele(EnumBeeChromosome.SPEED);
|
||||
IAlleleTolerance tempToleranceAllele = (IAlleleTolerance)getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceAllele = (IAlleleTolerance)getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
|
||||
String unlocalizedCustomSpeed = "tooltip.worker." + speedAllele.getUnlocalizedName().replaceFirst("gui.", "");
|
||||
String speed;
|
||||
if (StringUtil.canTranslate(unlocalizedCustomSpeed))
|
||||
speed = StringUtil.localize(unlocalizedCustomSpeed);
|
||||
else
|
||||
list.add(speed.getName() + " " + StringUtil.localize("gui.worker"));
|
||||
speed = speedAllele.getName() + " " + StringUtil.localize("gui.worker");
|
||||
|
||||
list.add(genome.getActiveAllele(EnumBeeChromosome.LIFESPAN.ordinal()).getName() + " " + StringUtil.localize("gui.life"));
|
||||
String lifespan = genome.getActiveAllele(EnumBeeChromosome.LIFESPAN).getName() + " " + StringUtil.localize("gui.life");
|
||||
String tempTolerance = EnumChatFormatting.GREEN + "T: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getTemperature()) + " / " + tempToleranceAllele.getName();
|
||||
String humidTolerance = EnumChatFormatting.GREEN + "H: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getHumidity()) + " / " + humidToleranceAllele.getName();
|
||||
String flowers = genome.getFlowerProvider().getDescription();
|
||||
|
||||
IAlleleTolerance tempTolerance = (IAlleleTolerance)getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal());
|
||||
list.add("\u00A7aT: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getTemperature()) + " / " + tempTolerance.getName());
|
||||
list.add(lifespan);
|
||||
list.add(speed);
|
||||
list.add(tempTolerance);
|
||||
list.add(humidTolerance);
|
||||
list.add(flowers);
|
||||
|
||||
IAlleleTolerance humidTolerance = (IAlleleTolerance)getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal());
|
||||
list.add("\u00A7aH: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getHumidity()) + " / " + humidTolerance.getName());
|
||||
|
||||
list.add(genome.getFlowerProvider().getDescription());
|
||||
if (genome.getNocturnal())
|
||||
list.add("\u00A7c" + GenericRatings.rateActivityTime(genome.getNocturnal(), false));
|
||||
list.add(EnumChatFormatting.RED + GenericRatings.rateActivityTime(genome.getNocturnal(), false));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -499,7 +524,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
toCreate = 1;
|
||||
|
||||
for (int i = 0; i < toCreate; i++) {
|
||||
IBee offspring = createOffspring(housing, -1);
|
||||
IBee offspring = createOffspring(housing, 0);
|
||||
if (offspring != null) {
|
||||
offspring.setIsNatural(true);
|
||||
bees.add(offspring);
|
||||
@@ -534,7 +559,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
chromosomes[i] = Chromosome.inheritChromosome(world.rand, parent1[i], parent2[i]);
|
||||
|
||||
IBeekeepingMode mode = PluginApiculture.beeInterface.getBeekeepingMode(world);
|
||||
IBee offspring = new Bee(world, new BeeGenome(chromosomes), mode.isNaturalOffspring(this), generation);
|
||||
IBee offspring = new Bee(new BeeGenome(chromosomes), mode.isNaturalOffspring(this), generation);
|
||||
|
||||
/* Disabling the mutation rate nerf
|
||||
// All mutation and no play makes queen a dull girl.
|
||||
@@ -571,14 +596,12 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
for (IBeeMutation mutation : PluginApiculture.beeInterface.getMutations(true)) {
|
||||
float chance = 0;
|
||||
|
||||
if ((chance = mutation.getChance(housing, allele0, allele1, genome0, genome1)) > 0)
|
||||
if (world.rand.nextFloat()*100 < chance) {
|
||||
IApiaristTracker breedingTracker = PluginApiculture.beeInterface.getBreedingTracker(world, housing.getOwnerName());
|
||||
breedingTracker.registerMutation(mutation);
|
||||
return PluginApiculture.beeInterface.templateAsChromosomes(mutation.getTemplate());
|
||||
}
|
||||
float chance = mutation.getChance(housing, allele0, allele1, genome0, genome1);
|
||||
if (chance > world.rand.nextFloat() * 100) {
|
||||
IApiaristTracker breedingTracker = PluginApiculture.beeInterface.getBreedingTracker(world, housing.getOwnerName());
|
||||
breedingTracker.registerMutation(mutation);
|
||||
return PluginApiculture.beeInterface.templateAsChromosomes(mutation.getTemplate());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -588,56 +611,34 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public IIndividual retrievePollen(IBeeHousing housing) {
|
||||
|
||||
int chance = (int) (genome.getFlowering() * housing.getFloweringModifier(getGenome(), 1f));
|
||||
int chance = Math.round(genome.getFlowering() * housing.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
World world = housing.getWorld();
|
||||
Random random = world.rand;
|
||||
|
||||
// Correct speed
|
||||
if (housing.getWorld().rand.nextInt(100) >= chance)
|
||||
if (random.nextInt(100) >= chance)
|
||||
return null;
|
||||
|
||||
int[] areaAr = genome.getTerritory();
|
||||
Vect area = new Vect(areaAr[0], areaAr[1], areaAr[2]).multiply(housing.getTerritoryModifier(genome, 1f)).multiply(3.0f);
|
||||
Vect offset = new Vect(-Math.round(area.x / 2), -Math.round(area.y / 2), -Math.round(area.z / 2));
|
||||
Vect area = getArea(genome, housing);
|
||||
Vect offset = new Vect(-area.x / 2, -area.y / 4, -area.z / 2);
|
||||
Vect housingPos = new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord());
|
||||
|
||||
if (area.x < 1)
|
||||
area.x = 1;
|
||||
if (area.y < 1)
|
||||
area.y = 1;
|
||||
if (area.z < 1)
|
||||
area.z = 1;
|
||||
IIndividual pollen = null;
|
||||
|
||||
// We have up to ten attempts
|
||||
for (int i = 0; i < 20; i++) {
|
||||
Vect randomPos = Vect.getRandomPositionInArea(random, area);
|
||||
Vect blockPos = Vect.add(housingPos, randomPos, offset);
|
||||
TileEntity tile = world.getTileEntity(blockPos.x, blockPos.y, blockPos.z);
|
||||
|
||||
Vect randomPos = new Vect(housing.getWorld().rand.nextInt(area.x), housing.getWorld().rand.nextInt(area.y), housing.getWorld().rand.nextInt(area.z));
|
||||
|
||||
Vect posBlock = randomPos.add(new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord()));
|
||||
posBlock = posBlock.add(offset);
|
||||
|
||||
TileEntity tile = housing.getWorld().getTileEntity(posBlock.x, posBlock.y, posBlock.z);
|
||||
if (!(tile instanceof IPollinatable)) {
|
||||
if (housing.getWorld().isAirBlock(posBlock.x, posBlock.y, posBlock.z))
|
||||
continue;
|
||||
|
||||
// Test for ersatz genomes
|
||||
for (Map.Entry<ItemStack, IIndividual> entry : AlleleManager.ersatzSpecimen.entrySet()) {
|
||||
if (!StackUtils.equals(housing.getWorld().getBlock(posBlock.x, posBlock.y, posBlock.z), entry.getKey()))
|
||||
continue;
|
||||
if (entry.getKey().getItemDamage() != housing.getWorld().getBlockMetadata(posBlock.x, posBlock.y, posBlock.z))
|
||||
continue;
|
||||
|
||||
// We matched, return ersatz genome
|
||||
return entry.getValue().copy();
|
||||
}
|
||||
|
||||
continue;
|
||||
if (tile instanceof IPollinatable) {
|
||||
IPollinatable pitcher = (IPollinatable) tile;
|
||||
if (genome.getFlowerProvider().isAcceptedPollinatable(world, pitcher))
|
||||
pollen = pitcher.getPollen();
|
||||
} else {
|
||||
pollen = GeneticsUtil.getErsatzPollen(world, blockPos.x, blockPos.y, blockPos.z);
|
||||
}
|
||||
|
||||
IPollinatable pitcher = (IPollinatable) tile;
|
||||
if (!genome.getFlowerProvider().isAcceptedPollinatable(housing.getWorld(), pitcher))
|
||||
continue;
|
||||
|
||||
IIndividual pollen = pitcher.getPollen();
|
||||
|
||||
if (pollen != null)
|
||||
return pollen;
|
||||
}
|
||||
@@ -650,34 +651,27 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
int chance = (int) (genome.getFlowering() * housing.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
World world = housing.getWorld();
|
||||
Random random = world.rand;
|
||||
|
||||
// Correct speed
|
||||
if (housing.getWorld().rand.nextInt(100) >= chance)
|
||||
if (random.nextInt(100) >= chance)
|
||||
return false;
|
||||
|
||||
int[] areaAr = genome.getTerritory();
|
||||
Vect area = new Vect(areaAr[0], areaAr[1], areaAr[2]).multiply(housing.getTerritoryModifier(genome, 1f)).multiply(3.0f);
|
||||
Vect offset = new Vect(-Math.round(area.x / 2), -Math.round(area.y / 4), -Math.round(area.z / 2));
|
||||
Vect area = getArea(genome, housing);
|
||||
Vect offset = new Vect(-area.x / 2, -area.y / 4, -area.z / 2);
|
||||
Vect housingPos = new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord());
|
||||
|
||||
if (area.x < 1)
|
||||
area.x = 1;
|
||||
if (area.y < 1)
|
||||
area.y = 1;
|
||||
if (area.z < 1)
|
||||
area.z = 1;
|
||||
|
||||
// We have up to ten attempts
|
||||
for (int i = 0; i < 30; i++) {
|
||||
|
||||
Vect randomPos = new Vect(housing.getWorld().rand.nextInt(area.x), housing.getWorld().rand.nextInt(area.y), housing.getWorld().rand.nextInt(area.z));
|
||||
Vect randomPos = Vect.getRandomPositionInArea(random, area);
|
||||
Vect posBlock = Vect.add(housingPos, randomPos, offset);
|
||||
|
||||
Vect posBlock = randomPos.add(new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord()));
|
||||
posBlock = posBlock.add(offset);
|
||||
|
||||
IPollinatable receiver = Utils.getOrCreatePollinatable(housing.getOwnerName(), housing.getWorld(), posBlock.x, posBlock.y, posBlock.z);
|
||||
IPollinatable receiver = GeneticsUtil.getOrCreatePollinatable(housing.getOwnerName(), world, posBlock.x, posBlock.y, posBlock.z);
|
||||
if(receiver == null)
|
||||
continue;
|
||||
|
||||
if (!genome.getFlowerProvider().isAcceptedPollinatable(housing.getWorld(), receiver))
|
||||
if (!genome.getFlowerProvider().isAcceptedPollinatable(world, receiver))
|
||||
continue;
|
||||
if (!receiver.canMateWith(pollen))
|
||||
continue;
|
||||
@@ -692,35 +686,33 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public void plantFlowerRandom(IBeeHousing housing) {
|
||||
|
||||
int chance = (int) (genome.getFlowering() * housing.getFloweringModifier(getGenome(), 1f));
|
||||
int chance = Math.round(genome.getFlowering() * housing.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
World world = housing.getWorld();
|
||||
Random random = world.rand;
|
||||
|
||||
// Correct speed
|
||||
if (housing.getWorld().rand.nextInt(100) >= chance)
|
||||
if (random.nextInt(100) >= chance)
|
||||
return;
|
||||
|
||||
// Gather required info
|
||||
IFlowerProvider provider = genome.getFlowerProvider();
|
||||
int[] areaAr = genome.getTerritory();
|
||||
Vect area = new Vect(areaAr[0], areaAr[1], areaAr[2]).multiply(housing.getTerritoryModifier(genome, 1f)).multiply(3.0f);
|
||||
Vect offset = new Vect(-Math.round(area.x / 2), -Math.round(area.y / 4), -Math.round(area.z / 2));
|
||||
Vect area = getArea(genome, housing);
|
||||
Vect offset = new Vect(-area.x / 2, -area.y / 4, -area.z / 2);
|
||||
Vect housingPos = new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord());
|
||||
|
||||
if (area.x < 1)
|
||||
area.x = 1;
|
||||
if (area.y < 1)
|
||||
area.y = 1;
|
||||
if (area.z < 1)
|
||||
area.z = 1;
|
||||
|
||||
// We have up to ten attempts
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Vect randomPos = Vect.getRandomPositionInArea(random, area);
|
||||
Vect posBlock = Vect.add(housingPos, randomPos, offset);
|
||||
|
||||
Vect randomPos = new Vect(housing.getWorld().rand.nextInt(area.x), housing.getWorld().rand.nextInt(area.y), housing.getWorld().rand.nextInt(area.z));
|
||||
|
||||
Vect posBlock = randomPos.add(new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord()));
|
||||
posBlock = posBlock.add(offset);
|
||||
|
||||
if (provider.growFlower(housing.getWorld(), this, posBlock.x, posBlock.y, posBlock.z))
|
||||
if (provider.growFlower(world, this, posBlock.x, posBlock.y, posBlock.z))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static Vect getArea(IBeeGenome genome, IBeeHousing housing) {
|
||||
int[] genomeTerritory = genome.getTerritory();
|
||||
float housingModifier = housing.getTerritoryModifier(genome, 1f);
|
||||
return new Vect(genomeTerritory).multiply(housingModifier * 3.0f);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import forestry.core.genetics.AlleleArea;
|
||||
import forestry.core.genetics.AlleleBoolean;
|
||||
import forestry.core.genetics.AlleleTolerance;
|
||||
import forestry.core.genetics.Genome;
|
||||
import forestry.core.utils.Vect;
|
||||
import forestry.core.vect.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -72,7 +72,7 @@ public class BeeGenome extends Genome implements IBeeGenome {
|
||||
|
||||
// NBT RETRIEVAL
|
||||
public static IAlleleBeeSpecies getSpecies(ItemStack itemStack) {
|
||||
IAllele speciesAllele = Genome.getPrimaryAllele(itemStack, EnumBeeChromosome.SPECIES);
|
||||
IAllele speciesAllele = Genome.getActiveAllele(itemStack, EnumBeeChromosome.SPECIES);
|
||||
if (speciesAllele instanceof IAlleleBeeSpecies)
|
||||
return (IAlleleBeeSpecies)speciesAllele;
|
||||
else
|
||||
@@ -82,73 +82,73 @@ public class BeeGenome extends Genome implements IBeeGenome {
|
||||
// / INFORMATION RETRIEVAL
|
||||
@Override
|
||||
public IAlleleBeeSpecies getPrimary() {
|
||||
return (IAlleleBeeSpecies) getActiveAllele(EnumBeeChromosome.SPECIES.ordinal());
|
||||
return (IAlleleBeeSpecies) getActiveAllele(EnumBeeChromosome.SPECIES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleBeeSpecies getSecondary() {
|
||||
return (IAlleleBeeSpecies) getInactiveAllele(EnumBeeChromosome.SPECIES.ordinal());
|
||||
return (IAlleleBeeSpecies) getInactiveAllele(EnumBeeChromosome.SPECIES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpeed() {
|
||||
return ((IAlleleFloat) getActiveAllele(EnumBeeChromosome.SPEED.ordinal())).getValue();
|
||||
return ((IAlleleFloat) getActiveAllele(EnumBeeChromosome.SPEED)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLifespan() {
|
||||
return ((IAlleleInteger) getActiveAllele(EnumBeeChromosome.LIFESPAN.ordinal())).getValue();
|
||||
return ((IAlleleInteger) getActiveAllele(EnumBeeChromosome.LIFESPAN)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFertility() {
|
||||
return ((IAlleleInteger) getActiveAllele(EnumBeeChromosome.FERTILITY.ordinal())).getValue();
|
||||
return ((IAlleleInteger) getActiveAllele(EnumBeeChromosome.FERTILITY)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTolerance getToleranceTemp() {
|
||||
return ((AlleleTolerance) getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal())).getValue();
|
||||
return ((AlleleTolerance) getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getNocturnal() {
|
||||
return ((AlleleBoolean) getActiveAllele(EnumBeeChromosome.NOCTURNAL.ordinal())).getValue();
|
||||
return ((AlleleBoolean) getActiveAllele(EnumBeeChromosome.NOCTURNAL)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTolerance getToleranceHumid() {
|
||||
return ((AlleleTolerance) getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal())).getValue();
|
||||
return ((AlleleTolerance) getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTolerantFlyer() {
|
||||
return ((AlleleBoolean) getActiveAllele(EnumBeeChromosome.TOLERANT_FLYER.ordinal())).getValue();
|
||||
return ((AlleleBoolean) getActiveAllele(EnumBeeChromosome.TOLERANT_FLYER)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCaveDwelling() {
|
||||
return ((AlleleBoolean) getActiveAllele(EnumBeeChromosome.CAVE_DWELLING.ordinal())).getValue();
|
||||
return ((AlleleBoolean) getActiveAllele(EnumBeeChromosome.CAVE_DWELLING)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerProvider getFlowerProvider() {
|
||||
return ((IAlleleFlowers) getActiveAllele(EnumBeeChromosome.FLOWER_PROVIDER.ordinal())).getProvider();
|
||||
return ((IAlleleFlowers) getActiveAllele(EnumBeeChromosome.FLOWER_PROVIDER)).getProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlowering() {
|
||||
return ((IAlleleInteger) getActiveAllele(EnumBeeChromosome.FLOWERING.ordinal())).getValue();
|
||||
return ((IAlleleInteger) getActiveAllele(EnumBeeChromosome.FLOWERING)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getTerritory() {
|
||||
Vect area = ((AlleleArea) getActiveAllele(EnumBeeChromosome.TERRITORY.ordinal())).getArea();
|
||||
Vect area = ((AlleleArea) getActiveAllele(EnumBeeChromosome.TERRITORY)).getArea();
|
||||
return new int[] { area.x, area.y, area.z };
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleBeeEffect getEffect() {
|
||||
return (IAlleleBeeEffect) getActiveAllele(EnumBeeChromosome.EFFECT.ordinal());
|
||||
return (IAlleleBeeEffect) getActiveAllele(EnumBeeChromosome.EFFECT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,7 +13,6 @@ package forestry.apiculture.genetics;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@@ -22,10 +21,10 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
@@ -69,9 +68,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
public int getSpeciesCount() {
|
||||
if (beeSpeciesCount < 0) {
|
||||
beeSpeciesCount = 0;
|
||||
Iterator<Entry<String, IAllele> > it = AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry<String, IAllele> entry = it.next();
|
||||
for (Entry<String, IAllele> entry : AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) {
|
||||
if (entry.getValue() instanceof IAlleleBeeSpecies)
|
||||
if (((IAlleleBeeSpecies) entry.getValue()).isCounted())
|
||||
beeSpeciesCount++;
|
||||
@@ -101,7 +98,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
if (!isMember(bee))
|
||||
return null;
|
||||
|
||||
Item beeItem = null;
|
||||
Item beeItem;
|
||||
switch (EnumBeeType.VALUES[type]) {
|
||||
case QUEEN:
|
||||
beeItem = ForestryItem.beeQueenGE.item();
|
||||
@@ -117,7 +114,6 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Cannot instantiate a bee of type " + type);
|
||||
|
||||
}
|
||||
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
@@ -160,8 +156,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
|
||||
@Override
|
||||
public IBee getMember(ItemStack stack) {
|
||||
if (!ForestryItem.beeQueenGE.isItemEqual(stack) && !ForestryItem.beePrincessGE.isItemEqual(stack)
|
||||
&& !ForestryItem.beeDroneGE.isItemEqual(stack) && !ForestryItem.beeLarvaeGE.isItemEqual(stack))
|
||||
if (!isMember(stack))
|
||||
return null;
|
||||
|
||||
return new Bee(stack.getTagCompound());
|
||||
@@ -174,12 +169,12 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
|
||||
@Override
|
||||
public IBee getBee(World world, IBeeGenome genome) {
|
||||
return new Bee(world, genome);
|
||||
return new Bee(genome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBee getBee(World world, IBeeGenome genome, IBee mate) {
|
||||
return new Bee(world, genome, mate);
|
||||
return new Bee(genome, mate);
|
||||
}
|
||||
|
||||
/* GENOME CONVERSIONS */
|
||||
|
||||
@@ -10,13 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
@@ -26,6 +19,10 @@ import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.core.genetics.Mutation;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
public class BeeMutation extends Mutation implements IBeeMutation {
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.core.genetics.Allele;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class BeeTemplates {
|
||||
@@ -548,6 +547,24 @@ public class BeeTemplates {
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesRural;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getFarmerlyTemplate() {
|
||||
IAllele[] alleles = getAgrarianBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesFarmerly;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlow;
|
||||
alleles[EnumBeeChromosome.TERRITORY.ordinal()] = Allele.territoryLarge;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getAgrarianTemplate() {
|
||||
IAllele[] alleles = getAgrarianBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesArgrarian;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlow;
|
||||
alleles[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceBoth2;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectFertile;
|
||||
alleles[EnumBeeChromosome.TERRITORY.ordinal()] = Allele.territoryLarge;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
// / BOGGY BRANCH
|
||||
public static IAllele[] getBoggyBranchTemplate() {
|
||||
@@ -564,6 +581,25 @@ public class BeeTemplates {
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesMarshy;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getMiryTemplate() {
|
||||
IAllele[] alleles = getBoggyBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesMiry;
|
||||
alleles[EnumBeeChromosome.FERTILITY.ordinal()] = Allele.fertilityMaximum;
|
||||
alleles[EnumBeeChromosome.TOLERANT_FLYER.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.boolTrue;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getBoggyTemplate() {
|
||||
IAllele[] alleles = getBoggyBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesBoggy;
|
||||
alleles[EnumBeeChromosome.TOLERANT_FLYER.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectMycophilic;
|
||||
alleles[EnumBeeChromosome.TERRITORY.ordinal()] = Allele.territoryLarger;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
/* MONASTIC BRANCH */
|
||||
public static IAllele[] getMonasticBranchTemplate() {
|
||||
|
||||
@@ -10,16 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
@@ -143,10 +141,7 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
@Override
|
||||
public boolean isNaturalOffspring(IBee queen) {
|
||||
if (!queen.isNatural())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return queen.isNatural();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,11 +15,10 @@ import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class HiveDrop implements IHiveDrop {
|
||||
|
||||
|
||||
@@ -10,15 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.utils.Vect;
|
||||
import forestry.core.vect.Vect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class JubilanceDefault implements IJubilanceProvider {
|
||||
|
||||
|
||||
@@ -10,14 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
/**
|
||||
* Hermits will not produce if there are any other living creatures nearby.
|
||||
@@ -30,10 +28,7 @@ public class JubilanceProviderHermit extends JubilanceDefault {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
List list = housing.getWorld().getEntitiesWithinAABB(EntityLiving.class, bounding);
|
||||
if (list.size() > 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return list.size() <= 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,13 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class JubilanceReqRes implements IJubilanceProvider {
|
||||
|
||||
@@ -32,12 +32,11 @@ public class JubilanceReqRes implements IJubilanceProvider {
|
||||
if (blockRequired == null)
|
||||
return true;
|
||||
|
||||
Block block = housing.getWorld().getBlock(housing.getXCoord(), housing.getYCoord() - 1, housing.getZCoord());
|
||||
int meta = housing.getWorld().getBlockMetadata(housing.getXCoord(), housing.getYCoord() - 1, housing.getZCoord());
|
||||
if (StackUtils.equals(block, blockRequired) && meta == blockRequired.getItemDamage())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
World world = housing.getWorld();
|
||||
|
||||
Block block = world.getBlock(housing.getXCoord(), housing.getYCoord() - 1, housing.getZCoord());
|
||||
int meta = world.getBlockMetadata(housing.getXCoord(), housing.getYCoord() - 1, housing.getZCoord());
|
||||
return StackUtils.equals(block, meta, blockRequired);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,17 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.Vect;
|
||||
import forestry.core.vect.Vect;
|
||||
import java.lang.reflect.Field;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MutationEMC extends MutationReqRes {
|
||||
|
||||
|
||||
@@ -10,14 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MutationReqRes extends BeeMutation {
|
||||
|
||||
|
||||
@@ -10,11 +10,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class MutationTimeLimited extends BeeMutation {
|
||||
|
||||
|
||||
@@ -15,10 +15,9 @@ import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import forestry.apiculture.gadgets.TileAlvearyPlain;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.gui.slots.SlotClosed;
|
||||
import forestry.core.gui.slots.SlotCustom;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
|
||||
public class ContainerAlveary extends ContainerForestry {
|
||||
|
||||
@@ -31,27 +30,27 @@ public class ContainerAlveary extends ContainerForestry {
|
||||
tile.sendNetworkUpdate();
|
||||
|
||||
// Queen/Princess
|
||||
this.addSlot(new SlotCustom(tile, TileAlvearyPlain.SLOT_QUEEN, 29, 39, ForestryItem.beePrincessGE, ForestryItem.beeQueenGE));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, TileAlvearyPlain.SLOT_QUEEN, 29, 39));
|
||||
|
||||
// Drone
|
||||
this.addSlot(new SlotCustom(tile, TileAlvearyPlain.SLOT_DRONE, 29, 65, ForestryItem.beeDroneGE));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, TileAlvearyPlain.SLOT_DRONE, 29, 65));
|
||||
|
||||
// Product Inventory
|
||||
this.addSlot(new SlotClosed(tile, 2, 116, 52));
|
||||
this.addSlot(new SlotClosed(tile, 3, 137, 39));
|
||||
this.addSlot(new SlotClosed(tile, 4, 137, 65));
|
||||
this.addSlot(new SlotClosed(tile, 5, 116, 78));
|
||||
this.addSlot(new SlotClosed(tile, 6, 95, 65));
|
||||
this.addSlot(new SlotClosed(tile, 7, 95, 39));
|
||||
this.addSlot(new SlotClosed(tile, 8, 116, 26));
|
||||
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));
|
||||
|
||||
// Player inventory
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = 0; j < 9; j++)
|
||||
addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 108 + i * 18));
|
||||
addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 108 + i * 18));
|
||||
// Player hotbar
|
||||
for (int i = 0; i < 9; i++)
|
||||
addSlot(new Slot(player, i, 8 + i * 18, 166));
|
||||
addSlotToContainer(new Slot(player, i, 8 + i * 18, 166));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,28 +10,26 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import forestry.apiculture.gadgets.TileAlvearyHygroregulator;
|
||||
import forestry.core.gui.ContainerLiquidTanks;
|
||||
import forestry.core.gui.slots.SlotLiquidContainer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import forestry.apiculture.gadgets.TileAlvearyHygroregulator;
|
||||
import forestry.core.gui.ContainerLiquidTanks;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
|
||||
public class ContainerAlvearyHygroregulator extends ContainerLiquidTanks {
|
||||
|
||||
private final TileAlvearyHygroregulator tile;
|
||||
public ContainerAlvearyHygroregulator(IInventory playerInventory, TileAlvearyHygroregulator tile) {
|
||||
super(tile);
|
||||
|
||||
public ContainerAlvearyHygroregulator(IInventory inventory, TileAlvearyHygroregulator tile) {
|
||||
super(inventory, tile);
|
||||
|
||||
this.tile = tile;
|
||||
this.addSlot(new SlotLiquidContainer(tile, 0, 56, 38));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, TileAlvearyHygroregulator.SLOT_INPUT, 56, 38));
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int var4 = 0; var4 < 9; ++var4)
|
||||
this.addSlot(new Slot(inventory, var4 + i * 9 + 9, 8 + var4 * 18, 84 + i * 18));
|
||||
this.addSlotToContainer(new Slot(playerInventory, var4 + i * 9 + 9, 8 + var4 * 18, 84 + i * 18));
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
this.addSlot(new Slot(inventory, i, 8 + i * 18, 142));
|
||||
this.addSlotToContainer(new Slot(playerInventory, i, 8 + i * 18, 142));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,48 +10,37 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import forestry.apiculture.gadgets.TileAlvearySieve;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.gui.slots.SlotCustom;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
|
||||
public class ContainerAlvearySieve extends ContainerForestry {
|
||||
|
||||
private final TileAlvearySieve tile;
|
||||
|
||||
public ContainerAlvearySieve(InventoryPlayer player, TileAlvearySieve tile) {
|
||||
super(tile.getInternalInventory());
|
||||
super(tile);
|
||||
|
||||
this.tile = tile;
|
||||
IInventory inventory = tile.getInternalInventory();
|
||||
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));
|
||||
|
||||
addSlot(new SlotCustom(inventory, 0, 94, 52).setCrafter(tile));
|
||||
addSlot(new SlotCustom(inventory, 1, 115, 39).setCrafter(tile));
|
||||
addSlot(new SlotCustom(inventory, 2, 73, 39).setCrafter(tile));
|
||||
addSlot(new SlotCustom(inventory, 3, 94, 26).setCrafter(tile));
|
||||
|
||||
addSlot(new SlotCustom(inventory, TileAlvearySieve.SLOT_SIEVE, 43, 39, ForestryItem.craftingMaterial.getItemStack(1, 3)).setCrafter(tile));
|
||||
addSlotToContainer(new SlotFiltered(tile, TileAlvearySieve.SLOT_SIEVE, 43, 39).setCrafter(tile));
|
||||
|
||||
// Player inventory
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 87 + i * 18));
|
||||
addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 87 + i * 18));
|
||||
}
|
||||
}
|
||||
// Player hotbar
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlot(new Slot(player, i, 8 + i * 18, 145));
|
||||
addSlotToContainer(new Slot(player, i, 8 + i * 18, 145));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return tile.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
@@ -10,38 +10,30 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.apiculture.gadgets.TileAlvearySwarmer;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.gui.slots.SlotCustom;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.Set;
|
||||
import forestry.apiculture.gadgets.TileAlvearySwarmer;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
|
||||
public class ContainerAlvearySwarmer extends ContainerForestry {
|
||||
|
||||
public ContainerAlvearySwarmer(InventoryPlayer player, TileAlvearySwarmer tile) {
|
||||
super(tile);
|
||||
|
||||
this.addSlot(new SlotCustom(tile, 0, 79, 52, getInducerItems()));
|
||||
this.addSlot(new SlotCustom(tile, 1, 100, 39, getInducerItems()));
|
||||
this.addSlot(new SlotCustom(tile, 2, 58, 39, getInducerItems()));
|
||||
this.addSlot(new SlotCustom(tile, 3, 79, 26, getInducerItems()));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, 0, 79, 52));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, 1, 100, 39));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, 2, 58, 39));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, 3, 79, 26));
|
||||
|
||||
// Player inventory
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = 0; j < 9; j++)
|
||||
addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 87 + i * 18));
|
||||
addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 87 + i * 18));
|
||||
// Player hotbar
|
||||
for (int i = 0; i < 9; i++)
|
||||
addSlot(new Slot(player, i, 8 + i * 18, 145));
|
||||
addSlotToContainer(new Slot(player, i, 8 + i * 18, 145));
|
||||
|
||||
}
|
||||
|
||||
private Object[] getInducerItems() {
|
||||
Set<ItemStack> inducers = BeeManager.inducers.keySet();
|
||||
return inducers.toArray(new Object[inducers.size()]);
|
||||
}
|
||||
}
|
||||
@@ -10,62 +10,56 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.apiculture.gadgets.TileBeehouse;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.gui.slots.SlotClosed;
|
||||
import forestry.core.gui.slots.SlotCustom;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
|
||||
public class ContainerApiary extends ContainerForestry {
|
||||
|
||||
private final TileBeehouse tile;
|
||||
|
||||
public ContainerApiary(InventoryPlayer player, TileBeehouse tile, boolean hasFrames) {
|
||||
super(tile.getInternalInventory());
|
||||
super(tile);
|
||||
|
||||
this.tile = tile;
|
||||
tile.sendNetworkUpdate();
|
||||
IInventory inventory = tile.getInternalInventory();
|
||||
|
||||
// Queen/Princess
|
||||
this.addSlot(new SlotCustom(inventory, TileBeehouse.SLOT_QUEEN, 29, 39, ForestryItem.beePrincessGE, ForestryItem.beeQueenGE));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, TileBeehouse.SLOT_QUEEN, 29, 39));
|
||||
|
||||
// Drone
|
||||
this.addSlot(new SlotCustom(inventory, TileBeehouse.SLOT_DRONE, 29, 65, ForestryItem.beeDroneGE));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, TileBeehouse.SLOT_DRONE, 29, 65));
|
||||
|
||||
// Frames
|
||||
if (hasFrames) {
|
||||
this.addSlot(new SlotCustom(inventory, TileBeehouse.SLOT_FRAMES_1, 66, 23, IHiveFrame.class));
|
||||
this.addSlot(new SlotCustom(inventory, TileBeehouse.SLOT_FRAMES_1 + 1, 66, 52, IHiveFrame.class));
|
||||
this.addSlot(new SlotCustom(inventory, TileBeehouse.SLOT_FRAMES_1 + 2, 66, 81, IHiveFrame.class));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, TileBeehouse.SLOT_FRAMES_1, 66, 23));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, TileBeehouse.SLOT_FRAMES_1 + 1, 66, 52));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, TileBeehouse.SLOT_FRAMES_1 + 2, 66, 81));
|
||||
}
|
||||
|
||||
// Product Inventory
|
||||
this.addSlot(new SlotClosed(inventory, 2, 116, 52));
|
||||
this.addSlot(new SlotClosed(inventory, 3, 137, 39));
|
||||
this.addSlot(new SlotClosed(inventory, 4, 137, 65));
|
||||
this.addSlot(new SlotClosed(inventory, 5, 116, 78));
|
||||
this.addSlot(new SlotClosed(inventory, 6, 95, 65));
|
||||
this.addSlot(new SlotClosed(inventory, 7, 95, 39));
|
||||
this.addSlot(new SlotClosed(inventory, 8, 116, 26));
|
||||
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));
|
||||
|
||||
// Player inventory
|
||||
for (int i1 = 0; i1 < 3; i1++) {
|
||||
for (int l1 = 0; l1 < 9; l1++) {
|
||||
addSlot(new Slot(player, l1 + i1 * 9 + 9, 8 + l1 * 18, 108 + i1 * 18));
|
||||
addSlotToContainer(new Slot(player, l1 + i1 * 9 + 9, 8 + l1 * 18, 108 + i1 * 18));
|
||||
}
|
||||
}
|
||||
// Player hotbar
|
||||
for (int j1 = 0; j1 < 9; j1++) {
|
||||
addSlot(new Slot(player, j1, 8 + j1 * 18, 166));
|
||||
addSlotToContainer(new Slot(player, j1, 8 + j1 * 18, 166));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +76,4 @@ public class ContainerApiary extends ContainerForestry {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return Utils.isUseableByPlayer(entityplayer, tile, tile.getWorld(), tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
}
|
||||
@@ -10,17 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.apiculture.items.ItemBeeGE;
|
||||
import forestry.apiculture.items.ItemBiomefinder;
|
||||
import forestry.apiculture.items.ItemBiomefinder.BiomefinderInventory;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.gui.ContainerItemInventory;
|
||||
import forestry.core.gui.slots.SlotCustom;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerHabitatLocator extends ContainerItemInventory {
|
||||
|
||||
@@ -32,12 +30,12 @@ public class ContainerHabitatLocator extends ContainerItemInventory {
|
||||
this.inventory = inventory;
|
||||
|
||||
// Energy
|
||||
this.addSlot(new SlotCustom(inventory, 2, 152, 8, ForestryItem.honeydew, ForestryItem.honeyDrop));
|
||||
this.addSlotToContainer(new SlotFiltered(inventory, 2, 152, 8));
|
||||
|
||||
// Bee to analyze
|
||||
this.addSlot(new SlotCustom(inventory, 0, 152, 32, ItemBeeGE.class));
|
||||
this.addSlotToContainer(new SlotFiltered(inventory, 0, 152, 32));
|
||||
// Analyzed bee
|
||||
this.addSlot(new SlotCustom(inventory, 1, 152, 75, ItemBeeGE.class));
|
||||
this.addSlotToContainer(new SlotFiltered(inventory, 1, 152, 75));
|
||||
|
||||
// Player inventory
|
||||
for (int i1 = 0; i1 < 3; i1++)
|
||||
@@ -69,9 +67,4 @@ public class ContainerHabitatLocator extends ContainerItemInventory {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAcceptedItem(EntityPlayer player, ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,11 +16,11 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.apiculture.items.ItemBeeGE;
|
||||
import forestry.apiculture.items.ItemImprinter.ImprinterInventory;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.gui.IGuiSelectable;
|
||||
import forestry.core.gui.slots.SlotCustom;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
import forestry.core.network.PacketIds;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.network.PacketUpdate;
|
||||
@@ -36,17 +36,17 @@ public class ContainerImprinter extends ContainerForestry implements IGuiSelecta
|
||||
|
||||
this.inventory = inventory;
|
||||
// Input
|
||||
this.addSlot(new SlotCustom(inventory, 0, 152, 12, ItemBeeGE.class));
|
||||
this.addSlotToContainer(new SlotFiltered(inventory, 0, 152, 12));
|
||||
// Output
|
||||
this.addSlot(new SlotCustom(inventory, 1, 152, 72, ItemBeeGE.class));
|
||||
this.addSlotToContainer(new SlotOutput(inventory, 1, 152, 72));
|
||||
|
||||
// Player inventory
|
||||
for (int i1 = 0; i1 < 3; i1++)
|
||||
for (int l1 = 0; l1 < 9; l1++)
|
||||
addSlot(new Slot(inventoryplayer, l1 + i1 * 9 + 9, 8 + l1 * 18, 103 + i1 * 18));
|
||||
addSlotToContainer(new Slot(inventoryplayer, l1 + i1 * 9 + 9, 8 + l1 * 18, 103 + i1 * 18));
|
||||
// Player hotbar
|
||||
for (int j1 = 0; j1 < 9; j1++)
|
||||
addSlot(new Slot(inventoryplayer, j1, 8 + j1 * 18, 161));
|
||||
addSlotToContainer(new Slot(inventoryplayer, j1, 8 + j1 * 18, 161));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,13 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.gadgets.TileAlvearyPlain;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.Utils;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class GuiAlveary extends GuiForestryTitled<TileAlvearyPlain> {
|
||||
|
||||
|
||||
@@ -10,12 +10,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.gadgets.TileAlvearyHygroregulator;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import forestry.core.gui.widgets.TankWidget;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class GuiAlvearyHygroregulator extends GuiForestryTitled<TileAlvearyHygroregulator> {
|
||||
|
||||
|
||||
@@ -10,11 +10,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.gadgets.TileAlvearySieve;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.gui.GuiForestry;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class GuiAlvearySieve extends GuiForestry<TileAlvearySieve> {
|
||||
|
||||
|
||||
@@ -10,11 +10,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.gadgets.TileAlvearySwarmer;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.gui.GuiForestry;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class GuiAlvearySwarmer extends GuiForestry<TileAlvearySwarmer> {
|
||||
|
||||
|
||||
@@ -10,14 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.gadgets.TileApiary;
|
||||
import forestry.apiculture.gadgets.TileBeehouse;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.Utils;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class GuiApiary extends GuiForestryTitled<TileBeehouse> {
|
||||
|
||||
|
||||
@@ -10,45 +10,38 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleFlowers;
|
||||
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.core.genetics.AlleleArea;
|
||||
import forestry.core.genetics.AlleleBoolean;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.gui.GuiAlyzer;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Vect;
|
||||
import forestry.core.vect.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GuiBeealyzer extends GuiAlyzer {
|
||||
|
||||
private ItemStack[] tempProductList;
|
||||
|
||||
public GuiBeealyzer(EntityPlayer player, BeealyzerInventory inventory) {
|
||||
super(AlleleManager.alleleRegistry.getSpeciesRoot("rootBees"), player,
|
||||
new ContainerBeealyzer(player.inventory, inventory), inventory, 1, inventory.getSizeInventory());
|
||||
|
||||
guiName = "gui.beealyzer";
|
||||
super("rootBees", player, new ContainerAlyzer(inventory, player), inventory, "gui.beealyzer");
|
||||
|
||||
ArrayList<ItemStack> beeList = new ArrayList<ItemStack>();
|
||||
((ItemBeeGE) ForestryItem.beeDroneGE.item()).addCreativeItems(beeList, false);
|
||||
for (ItemStack beeStack : beeList)
|
||||
iconStacks.put(BeeGenome.getSpecies(beeStack).getUID(), beeStack);
|
||||
|
||||
breedingTracker = PluginApiculture.beeInterface.getBreedingTracker(player.worldObj, player.getGameProfile());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,7 +51,8 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
int page = 0;
|
||||
IBee bee = null;
|
||||
EnumBeeType beeType = EnumBeeType.DRONE;
|
||||
for (int k = 1; k < BeealyzerInventory.SLOT_ANALYZE_5 + 1; k++) {
|
||||
|
||||
for (int k = BeealyzerInventory.SLOT_SPECIMEN; k <= BeealyzerInventory.SLOT_ANALYZE_5; k++) {
|
||||
if (k == BeealyzerInventory.SLOT_ENERGY)
|
||||
continue;
|
||||
|
||||
@@ -111,37 +105,30 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
|
||||
drawSpeciesRow(StringUtil.localize("gui.species"), bee, EnumBeeChromosome.SPECIES, checkCustomName(customPrimaryBeeKey), checkCustomName(customSecondaryBeeKey));
|
||||
}
|
||||
drawRow(StringUtil.localize("gui.lifespan"), bee.getGenome().getActiveAllele(EnumBeeChromosome.LIFESPAN.ordinal()).getName(),
|
||||
bee.getGenome().getInactiveAllele(EnumBeeChromosome.LIFESPAN.ordinal()).getName(), bee,
|
||||
EnumBeeChromosome.LIFESPAN);
|
||||
drawChromosomeRow(StringUtil.localize("gui.lifespan"), bee, EnumBeeChromosome.LIFESPAN);
|
||||
|
||||
drawRow(StringUtil.localize("gui.speed"), bee.getGenome().getActiveAllele(EnumBeeChromosome.SPEED.ordinal()).getName(),
|
||||
bee.getGenome().getInactiveAllele(EnumBeeChromosome.SPEED.ordinal()).getName(), bee, EnumBeeChromosome.SPEED);
|
||||
drawChromosomeRow(StringUtil.localize("gui.speed"), bee, EnumBeeChromosome.SPEED);
|
||||
|
||||
drawRow(StringUtil.localize("gui.pollination"), bee.getGenome().getActiveAllele(EnumBeeChromosome.FLOWERING.ordinal()).getName(),
|
||||
bee.getGenome().getInactiveAllele(EnumBeeChromosome.FLOWERING.ordinal()).getName(), bee,
|
||||
EnumBeeChromosome.FLOWERING);
|
||||
drawChromosomeRow(StringUtil.localize("gui.pollination"), bee, EnumBeeChromosome.FLOWERING);
|
||||
|
||||
drawRow(StringUtil.localize("gui.flowers"), bee.getGenome().getFlowerProvider().getDescription(),
|
||||
((IAlleleFlowers) bee.getGenome().getInactiveAllele(EnumBeeChromosome.FLOWER_PROVIDER.ordinal())).getProvider()
|
||||
.getDescription(), bee, EnumBeeChromosome.FLOWER_PROVIDER);
|
||||
drawChromosomeRow(StringUtil.localize("gui.flowers"), bee, EnumBeeChromosome.FLOWER_PROVIDER);
|
||||
|
||||
drawLine(StringUtil.localize("gui.fertility"), COLUMN_0);
|
||||
drawFertilityInfo(bee.getGenome().getFertility(), COLUMN_1, getColorCoding(bee.getGenome().getActiveAllele(EnumBeeChromosome.FERTILITY.ordinal())
|
||||
.isDominant()), 0);
|
||||
drawFertilityInfo(((IAlleleInteger) bee.getGenome().getInactiveAllele(EnumBeeChromosome.FERTILITY.ordinal())).getValue(), COLUMN_2, getColorCoding(bee
|
||||
.getGenome().getInactiveAllele(EnumBeeChromosome.FERTILITY.ordinal()).isDominant()), 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);
|
||||
|
||||
newLine();
|
||||
|
||||
int[] areaAr = bee.getGenome().getTerritory();
|
||||
Vect area = new Vect(areaAr[0], areaAr[1], areaAr[2]);
|
||||
drawRow(StringUtil.localize("gui.area"), area.toString(), ((AlleleArea) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TERRITORY.ordinal()))
|
||||
.getArea().toString(), bee, EnumBeeChromosome.TERRITORY);
|
||||
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);
|
||||
|
||||
drawRow(StringUtil.localize("gui.effect"), bee.getGenome().getEffect().getName(),
|
||||
bee.getGenome().getInactiveAllele(EnumBeeChromosome.EFFECT.ordinal()).getName(), bee,
|
||||
EnumBeeChromosome.EFFECT);
|
||||
drawChromosomeRow(StringUtil.localize("gui.effect"), bee, EnumBeeChromosome.EFFECT);
|
||||
|
||||
newLine();
|
||||
|
||||
@@ -161,8 +148,8 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
drawRow(StringUtil.localize("gui.climate"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getTemperature()),
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getTemperature()), bee, EnumBeeChromosome.SPECIES);
|
||||
|
||||
IAlleleTolerance tempToleranceActive = (IAlleleTolerance)bee.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal());
|
||||
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance)bee.getGenome().getInactiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal());
|
||||
IAlleleTolerance tempToleranceActive = (IAlleleTolerance)bee.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance)bee.getGenome().getInactiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
drawLine(StringUtil.localize("gui.temptol"), COLUMN_0);
|
||||
drawToleranceInfo(tempToleranceActive, COLUMN_1);
|
||||
drawToleranceInfo(tempToleranceInactive, COLUMN_2);
|
||||
@@ -172,8 +159,8 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
drawRow(StringUtil.localize("gui.humidity"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getHumidity()),
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getHumidity()), bee, EnumBeeChromosome.SPECIES);
|
||||
|
||||
IAlleleTolerance humidToleranceActive = (IAlleleTolerance)bee.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal());
|
||||
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance)bee.getGenome().getInactiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal());
|
||||
IAlleleTolerance humidToleranceActive = (IAlleleTolerance)bee.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance)bee.getGenome().getInactiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
drawLine(StringUtil.localize("gui.humidtol"), COLUMN_0);
|
||||
drawToleranceInfo(humidToleranceActive, COLUMN_1);
|
||||
drawToleranceInfo(humidToleranceInactive, COLUMN_2);
|
||||
@@ -191,7 +178,7 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
nocturnal0 = bee.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
diurnal0 = !bee.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
}
|
||||
if(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.NOCTURNAL.ordinal())).getValue()) {
|
||||
if(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.NOCTURNAL)).getValue()) {
|
||||
nocturnal1 = diurnal1 = yes;
|
||||
} else {
|
||||
nocturnal1 = bee.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
@@ -209,13 +196,13 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
newLine();
|
||||
|
||||
String primary = StringUtil.readableBoolean(bee.getGenome().getTolerantFlyer(), yes, no);
|
||||
String secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TOLERANT_FLYER.ordinal())).getValue(), yes,
|
||||
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);
|
||||
|
||||
primary = StringUtil.readableBoolean(bee.getGenome().getCaveDwelling(), yes, no);
|
||||
secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.CAVE_DWELLING.ordinal())).getValue(), yes,
|
||||
secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.CAVE_DWELLING)).getValue(), yes,
|
||||
no);
|
||||
|
||||
drawRow(StringUtil.localize("gui.cave"), primary, secondary, bee, EnumBeeChromosome.CAVE_DWELLING);
|
||||
@@ -246,8 +233,6 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
float factor = this.factor;
|
||||
this.setFactor(1.0f);
|
||||
|
||||
tempProductList = bee.getProduceList();
|
||||
|
||||
startPage(COLUMN_0, COLUMN_1, COLUMN_2);
|
||||
|
||||
drawLine(StringUtil.localize("gui.beealyzer.produce") + ":", COLUMN_0);
|
||||
@@ -255,7 +240,7 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
newLine();
|
||||
|
||||
int x = COLUMN_0;
|
||||
for (ItemStack stack : tempProductList) {
|
||||
for (ItemStack stack : bee.getProduceList()) {
|
||||
widgetManager.add(new ItemStackWidget(adjustToFactor(x), adjustToFactor(getLineY()), stack));
|
||||
|
||||
x += 18;
|
||||
@@ -270,6 +255,7 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
newLine();
|
||||
|
||||
drawLine(StringUtil.localize("gui.beealyzer.specialty") + ":", COLUMN_0);
|
||||
newLine();
|
||||
|
||||
x = COLUMN_0;
|
||||
for (ItemStack stack : bee.getSpecialtyList()) {
|
||||
|
||||
@@ -10,17 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.apiculture.items.ItemBiomefinder.BiomefinderInventory;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.gadgets.TileForestry;
|
||||
@@ -30,6 +19,14 @@ import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.SpriteSheet;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiHabitatLocator extends GuiForestry<TileForestry> {
|
||||
|
||||
|
||||
Loaded 100 of 786 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user