mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 01:24:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac653d46c1 | ||
|
|
63d9935d01 | ||
|
|
ba695b977d | ||
|
|
6b1dfb1596 | ||
|
|
fff02be71d | ||
|
|
0e5b9e4957 | ||
|
|
d385a25efa | ||
|
|
5f52cf54cb | ||
|
|
acb85e75ef | ||
|
|
220ce0b6a2 | ||
|
|
63ec46d830 | ||
|
|
06907ae3d4 | ||
|
|
cb805e3a22 | ||
|
|
393bd691d8 | ||
|
|
3a5275396b | ||
|
|
7d72a60f9b | ||
|
|
32313cfe6a | ||
|
|
9f0084c1b7 | ||
|
|
13d89fc347 | ||
|
|
8bf9184ba4 | ||
|
|
5487aba3a2 | ||
|
|
66a74703f8 | ||
|
|
c9bd15a20d | ||
|
|
486b7a8f80 | ||
|
|
bc2e27e495 | ||
|
|
e028428a67 | ||
|
|
a9b72c85bd | ||
|
|
247cb0b336 | ||
|
|
50a155aa2a | ||
|
|
f47d349056 | ||
|
|
4c52620f0f | ||
|
|
f4121b0849 | ||
|
|
3415030fbf | ||
|
|
f0dedf56a5 | ||
|
|
71b0a7bc1d | ||
|
|
c8fd93873a | ||
|
|
d1baa7d69c | ||
|
|
8c19ba73cb | ||
|
|
7d373ad75b | ||
|
|
5960f800e7 | ||
|
|
eb4fcf3267 | ||
|
|
1f9d4badc3 | ||
|
|
b60b5c1251 | ||
|
|
d7dc7a8c69 | ||
|
|
5e9cc9e2b1 | ||
|
|
4fcb9cb221 | ||
|
|
1e4db46584 | ||
|
|
eb102ac7d7 | ||
|
|
01388ca02e | ||
|
|
2792eda133 | ||
|
|
7fbdb8b670 | ||
|
|
ef3a62a9e7 | ||
|
|
cbf8822d1e | ||
|
|
ec088976cb | ||
|
|
704acf008c | ||
|
|
3bb0acc04c | ||
|
|
7ae094ab72 | ||
|
|
911aa8ca5c | ||
|
|
9a1888e85c | ||
|
|
955ae9640a | ||
|
|
d510e121eb | ||
|
|
46c4c65488 | ||
|
|
087780fbf8 | ||
|
|
46f5b2fb46 | ||
|
|
056dc75fab | ||
|
|
814e48ba5a | ||
|
|
ebcdf7fbf5 | ||
|
|
625b5038a5 | ||
|
|
9ec59e9dcd | ||
|
|
4600180cb7 | ||
|
|
1f2c32669e | ||
|
|
4b2336bae2 | ||
|
|
8816a5fea8 | ||
|
|
f8ff6f9ea4 | ||
|
|
c0ba391f4f | ||
|
|
bbcfa7bf2b | ||
|
|
270147ce36 | ||
|
|
dd4529aa75 | ||
|
|
a50198dd3d | ||
|
|
6bcd77ceff | ||
|
|
83d545e3c7 | ||
|
|
974ce7ea65 | ||
|
|
fe5d14643b | ||
|
|
548823813f | ||
|
|
cfd60a9610 | ||
|
|
a8583bfbfd | ||
|
|
f02426b219 | ||
|
|
d7aae80bdd | ||
|
|
e75afa927f | ||
|
|
6c0dc4a5d9 | ||
|
|
9acb76a676 | ||
|
|
5fb04e4467 | ||
|
|
c43d057339 | ||
|
|
ccd91f91d5 | ||
|
|
cea331470e | ||
|
|
d2960b19be | ||
|
|
bb708797ba | ||
|
|
c1b29f5c20 |
No files matched your search
@@ -1,3 +1,16 @@
|
||||
How to submit a bug report to Forestry
|
||||
====================================
|
||||
Please make sure the bug has not already been reported by [searching the issues](https://github.com/ForestryMC/ForestryMC/issues?q=is%3Aissue).
|
||||
|
||||
If you can, see if the bug still happens with the latest unstable build.
|
||||
[The latest unstable builds are available here](http://jenkins.ic2.player.to/job/Forestry_Dev/)
|
||||
|
||||
For crashes, you must post a link to the full crash report.
|
||||
[gist.github.com](gist.github.com) or [pastebin.com](www.pastebin.com) are good places to upload them.
|
||||
Full crash reports are located in [the minecraft data folder](http://hopper.minecraft.net/help/finding-minecraft-data-folder/), in "crash-reports".
|
||||
|
||||
Thank you for reporting bugs!
|
||||
|
||||
How to contribute to Forestry
|
||||
====================================
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Forestry
|
||||
====================================
|
||||
|
||||
|
||||
### What is it?
|
||||
|
||||
Forestry is a modification for the game Minecraft and known primarily for its farms and bees.
|
||||
@@ -9,10 +9,12 @@ Forestry is a modification for the game Minecraft and known primarily for its fa
|
||||
|
||||
[Wiki](http://forestry.sengir.net/)
|
||||
|
||||
[Latest Builds for 1.7.10](http://jenkins.ic2.player.to/job/Forestry/)
|
||||
[Latest Builds for 1.7.10](http://jenkins.ic2.player.to/job/Forestry_Dev/)
|
||||
|
||||
[IRC #forestry on esper.net](http://webchat.esper.net/?nick=ForestryGithub...&channels=forestry&prompt=1)
|
||||
|
||||
For those interested in developement, you can also visit #forestry-dev.
|
||||
|
||||
### Building
|
||||
|
||||
The API and localization files reside in their own repository. It is pulled in automatically.
|
||||
|
||||
+1
-1
Submodule api updated: b3c8d281a3...4f7ca82190.
@@ -1,6 +1,6 @@
|
||||
mcversion=1.7.10
|
||||
forgeversion=10.13.0.1207
|
||||
version_major=3
|
||||
version_minor=1
|
||||
version_patch=1
|
||||
version_minor=2
|
||||
version_patch=0
|
||||
|
||||
+21
-14
@@ -76,14 +76,14 @@ configurations {
|
||||
|
||||
dependencies {
|
||||
compile 'net.industrial-craft:industrialcraft-2:2.2.575-experimental:api'
|
||||
apis 'com.mod-buildcraft:buildcraft:6.0.18:dev'
|
||||
apis 'com.mod-buildcraft:buildcraft:6.1.5:dev'
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
||||
// this will ensure that this task is redone when the versions change.
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mcversion", project.minecraft.version
|
||||
// this will ensure that this task is redone when the versions change.
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mcversion", project.minecraft.version
|
||||
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
@@ -102,19 +102,19 @@ processResources {
|
||||
|
||||
runClient {
|
||||
if (project.hasProperty('mcUsername')) {
|
||||
args "--username=${project.mcUsername}"
|
||||
args "--username=" + project.mcUsername
|
||||
}
|
||||
if (project.hasProperty('mcPassword')) {
|
||||
args "--password=${project.mcPassword}"
|
||||
args "--password=" + project.mcPassword
|
||||
}
|
||||
}
|
||||
|
||||
debugClient {
|
||||
if (project.hasProperty('mcUsername')) {
|
||||
args "--username=${project.mcUsername}"
|
||||
args "--username=" + project.mcUsername
|
||||
}
|
||||
if (project.hasProperty('mcPassword')) {
|
||||
args "--password=${project.mcPassword}"
|
||||
args "--password=" + project.mcPassword
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,17 +157,19 @@ task bumpPatch << {
|
||||
saveVersion()
|
||||
}
|
||||
|
||||
import org.ajoberstar.grgit.Grgit
|
||||
|
||||
task initCraftGuide << {
|
||||
def localRepo = file(CraftGuideTmp)
|
||||
|
||||
if (localRepo.exists()) {
|
||||
println 'Updating CraftGuide repo'
|
||||
def grgit = org.ajoberstar.grgit.Grgit.open(localRepo)
|
||||
def grgit = Grgit.open(localRepo)
|
||||
grgit.pull()
|
||||
grgit.close()
|
||||
} else {
|
||||
println 'Cloning CraftGuide repo'
|
||||
def grgit = org.ajoberstar.grgit.Grgit.clone(dir: localRepo, uri: CraftGuideRepo)
|
||||
def grgit = Grgit.clone(dir: localRepo, uri: CraftGuideRepo)
|
||||
grgit.close()
|
||||
}
|
||||
}
|
||||
@@ -176,7 +178,7 @@ jar {
|
||||
destinationDir = file("build/tmp")
|
||||
archiveName = "main.jar"
|
||||
|
||||
from {
|
||||
from {
|
||||
configurations.apis.collect {
|
||||
it.isDirectory() ? it : zipTree(it).matching {
|
||||
include '**/api/**'
|
||||
@@ -189,6 +191,7 @@ task mainJarSigned ( type: Jar, dependsOn: 'reobf' ) {
|
||||
from (zipTree(jar.getArchivePath())) {
|
||||
exclude '**/api/**'
|
||||
exclude '**/codechicken/**'
|
||||
exclude '**/old/lang/**'
|
||||
}
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
@@ -214,7 +217,8 @@ task mainJar ( type: Zip, dependsOn: mainJarSigned ) {
|
||||
|
||||
from (zipTree(jar.getArchivePath())) {
|
||||
include '**'
|
||||
exclude '**/codechicken/**'
|
||||
exclude '**/codechicken/**'
|
||||
exclude '**/old/lang/**'
|
||||
}
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
@@ -227,6 +231,7 @@ task devJarSigned ( type: Jar, dependsOn: 'classes' ) {
|
||||
from(sourceSets.main.output) {
|
||||
exclude '**/api/**'
|
||||
exclude '**/codechicken/**'
|
||||
exclude '**/old/lang/**'
|
||||
}
|
||||
|
||||
destinationDir = file("build/tmp")
|
||||
@@ -251,12 +256,14 @@ task devJar ( type: Zip, dependsOn: devJarSigned ) {
|
||||
|
||||
from(sourceSets.main.allSource) {
|
||||
include '**'
|
||||
exclude '**/codechicken/**'
|
||||
exclude '**/codechicken/**'
|
||||
exclude '**/old/lang/**'
|
||||
}
|
||||
|
||||
from(sourceSets.main.output) {
|
||||
include '**'
|
||||
exclude '**/codechicken/**'
|
||||
exclude '**/codechicken/**'
|
||||
exclude '**/old/lang/**'
|
||||
}
|
||||
|
||||
from {
|
||||
|
||||
+1
-1
Submodule lang updated: c37b50751a...8ca6c91070.
@@ -4,7 +4,7 @@
|
||||
* 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
|
||||
******************************************************************************/
|
||||
@@ -28,13 +28,13 @@ import forestry.plugins.PluginApiculture;
|
||||
public class EntityBee extends EntityCreature implements IAnimals {
|
||||
|
||||
private static final String DEFAULT_TEXTURE = Defaults.TEXTURE_PATH_ENTITIES + "/bees/honeyBee.png";
|
||||
|
||||
|
||||
IBee contained;
|
||||
IAlleleBeeSpecies species;
|
||||
EnumBeeType type = EnumBeeType.DRONE;
|
||||
|
||||
private String beeTexture = DEFAULT_TEXTURE;
|
||||
private long lastUpdate;
|
||||
|
||||
private String beeTexture = DEFAULT_TEXTURE;
|
||||
private long lastUpdate;
|
||||
|
||||
public EntityBee(World world) {
|
||||
super(world);
|
||||
@@ -43,49 +43,50 @@ public class EntityBee extends EntityCreature implements IAnimals {
|
||||
private void resetAppearance() {
|
||||
beeTexture = species.getEntityTexture();
|
||||
}
|
||||
|
||||
|
||||
public EntityBee setIndividual(IBee bee) {
|
||||
if(bee != null)
|
||||
if (bee != null)
|
||||
contained = bee;
|
||||
else
|
||||
contained = PluginApiculture.beeInterface.templateAsIndividual(PluginApiculture.beeInterface.getDefaultTemplate());
|
||||
|
||||
|
||||
//isImmuneToFire = contained.getGenome().getFireResist();
|
||||
setSpecies(contained.getGenome().getPrimary());
|
||||
//dataWatcher.updateObject(DATAWATCHER_ID_SPECIES, species.getUID());
|
||||
//dataWatcher.updateObject(DATAWATCHER_ID_SCALE, (int)(contained.getSize() * 100));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public IBee getBee() {
|
||||
return contained;
|
||||
}
|
||||
|
||||
|
||||
public EntityBee setType(EnumBeeType type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public EnumBeeType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
public EntityBee setSpecies(IAlleleBeeSpecies species) {
|
||||
this.species = species;
|
||||
resetAppearance();
|
||||
lastUpdate = worldObj.getTotalWorldTime();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private ResourceLocation textureResource;
|
||||
private long lastTextureUpdate;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getTexture() {
|
||||
if(textureResource == null || lastTextureUpdate != lastUpdate)
|
||||
if (textureResource == null || lastTextureUpdate != lastUpdate)
|
||||
textureResource = new ForestryResource(beeTexture);
|
||||
|
||||
|
||||
return textureResource;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -10,15 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import forestry.api.apiculture.IAlvearyComponent;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
@@ -32,6 +24,12 @@ import forestry.core.proxy.Proxies;
|
||||
import forestry.core.triggers.ForestryTrigger;
|
||||
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 java.util.LinkedList;
|
||||
|
||||
public abstract class TileAlveary extends TileForestry implements IAlvearyComponent {
|
||||
|
||||
@@ -249,8 +247,8 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
|
||||
// / ITRIGGERPROVIDER
|
||||
@Override
|
||||
public LinkedList<ITrigger> getCustomTriggers() {
|
||||
LinkedList<ITrigger> res = new LinkedList<ITrigger>();
|
||||
public LinkedList<ITriggerExternal> getCustomTriggers() {
|
||||
LinkedList<ITriggerExternal> res = new LinkedList<ITriggerExternal>();
|
||||
res.add(ForestryTrigger.missingQueen);
|
||||
res.add(ForestryTrigger.missingDrone);
|
||||
return res;
|
||||
|
||||
@@ -10,14 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
@@ -25,6 +18,11 @@ import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.triggers.ForestryTrigger;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class TileApiary extends TileBeehouse implements ISidedInventory {
|
||||
|
||||
@@ -345,8 +343,8 @@ public class TileApiary extends TileBeehouse implements ISidedInventory {
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
@Override
|
||||
public LinkedList<ITrigger> getCustomTriggers() {
|
||||
LinkedList<ITrigger> res = new LinkedList<ITrigger>();
|
||||
public LinkedList<ITriggerExternal> getCustomTriggers() {
|
||||
LinkedList<ITriggerExternal> res = new LinkedList<ITriggerExternal>();
|
||||
res.add(ForestryTrigger.missingQueen);
|
||||
res.add(ForestryTrigger.missingDrone);
|
||||
res.add(PluginApiculture.triggerNoFrames);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.core.utils.StringUtil;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
@@ -46,8 +45,8 @@ public class AlleleEffectNone extends Allele implements IAlleleBeeEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return StringUtil.localize("apiculture.effect.none");
|
||||
public String getUnlocalizedName() {
|
||||
return "apiculture.effect.none";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,13 +19,11 @@ import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.EffectData;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public abstract class AlleleEffectThrottled extends Allele implements IAlleleBeeEffect {
|
||||
|
||||
private final String name;
|
||||
private boolean isCombinable = false;
|
||||
private final int throttle;
|
||||
private boolean requiresWorkingQueen = false;
|
||||
@@ -38,11 +36,6 @@ public abstract class AlleleEffectThrottled extends Allele implements IAlleleBee
|
||||
this.requiresWorkingQueen = requiresWorking;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return StringUtil.localize(name);
|
||||
}
|
||||
|
||||
public int getThrottle() {
|
||||
return throttle;
|
||||
}
|
||||
|
||||
@@ -10,19 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
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 net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
@@ -36,6 +23,7 @@ import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
@@ -53,6 +41,17 @@ import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.core.utils.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 net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
@@ -344,12 +343,22 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
IAlleleBeeSpecies secondary = genome.getSecondary();
|
||||
if (!isPureBred(EnumBeeChromosome.SPECIES.ordinal()))
|
||||
list.add("\u00A79" + StringUtil.localize("bees.hybrid").replaceAll("%PRIMARY",primary.getName()).replaceAll("%SECONDARY",secondary.getName()));
|
||||
list.add(genome.getActiveAllele(EnumBeeChromosome.SPEED.ordinal()).getName() + " " + StringUtil.localize("gui.worker"));
|
||||
|
||||
IAllele speed = genome.getActiveAllele(EnumBeeChromosome.SPEED.ordinal());
|
||||
String customWorker = "tooltip.worker." + speed.getUnlocalizedName().replaceFirst("gui.", "");
|
||||
if (StringUtil.canTranslate(customWorker))
|
||||
list.add(StringUtil.localize(customWorker));
|
||||
else
|
||||
list.add(speed.getName() + " " + StringUtil.localize("gui.worker"));
|
||||
|
||||
list.add(genome.getActiveAllele(EnumBeeChromosome.LIFESPAN.ordinal()).getName() + " " + StringUtil.localize("gui.life"));
|
||||
list.add("\u00A7aT: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getTemperature()) + " / "
|
||||
+ StringUtil.capitalize(genome.getToleranceTemp().name()));
|
||||
list.add("\u00A7aH: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getHumidity()) + " / "
|
||||
+ StringUtil.capitalize(genome.getToleranceHumid().name()));
|
||||
|
||||
IAlleleTolerance tempTolerance = (IAlleleTolerance)getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal());
|
||||
list.add("\u00A7aT: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getTemperature()) + " / " + tempTolerance.getName());
|
||||
|
||||
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));
|
||||
|
||||
@@ -10,13 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleFlowers;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
@@ -29,6 +28,8 @@ import forestry.core.genetics.AlleleTolerance;
|
||||
import forestry.core.genetics.Genome;
|
||||
import forestry.core.utils.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class BeeGenome extends Genome implements IBeeGenome {
|
||||
/**
|
||||
@@ -69,6 +70,15 @@ public class BeeGenome extends Genome implements IBeeGenome {
|
||||
super(chromosomes);
|
||||
}
|
||||
|
||||
// NBT RETRIEVAL
|
||||
public static IAlleleBeeSpecies getSpecies(ItemStack itemStack) {
|
||||
IAllele speciesAllele = Genome.getPrimaryAllele(itemStack, EnumBeeChromosome.SPECIES);
|
||||
if (speciesAllele instanceof IAlleleBeeSpecies)
|
||||
return (IAlleleBeeSpecies)speciesAllele;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
// / INFORMATION RETRIEVAL
|
||||
@Override
|
||||
public IAlleleBeeSpecies getPrimary() {
|
||||
|
||||
@@ -20,7 +20,7 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
public class ContainerBeealyzer extends ContainerAlyzer {
|
||||
|
||||
public ContainerBeealyzer(InventoryPlayer inventoryplayer, BeealyzerInventory inventory) {
|
||||
super(inventoryplayer, inventory, new Object[] { ForestryItem.honeydew, ForestryItem.honeyDrop }, new Object[] { ItemBeeGE.class });
|
||||
super(inventoryplayer, inventory, new Object[] { ForestryItem.honeydew, ForestryItem.honeyDrop }, ItemBeeGE.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,11 +10,6 @@
|
||||
******************************************************************************/
|
||||
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;
|
||||
@@ -22,16 +17,21 @@ import forestry.api.apiculture.IBee;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleFlowers;
|
||||
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.genetics.AlleleTolerance;
|
||||
import forestry.core.gui.GuiAlyzer;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.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 {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
ArrayList<ItemStack> beeList = new ArrayList<ItemStack>();
|
||||
((ItemBeeGE) ForestryItem.beeDroneGE.item()).addCreativeItems(beeList, false);
|
||||
for (ItemStack beeStack : beeList)
|
||||
iconStacks.put(PluginApiculture.beeInterface.getMember(beeStack).getIdent(), beeStack);
|
||||
iconStacks.put(BeeGenome.getSpecies(beeStack).getUID(), beeStack);
|
||||
|
||||
breedingTracker = PluginApiculture.beeInterface.getBreedingTracker(player.worldObj, player.getGameProfile());
|
||||
}
|
||||
@@ -161,22 +161,22 @@ 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());
|
||||
drawLine(StringUtil.localize("gui.temptol"), COLUMN_0);
|
||||
drawToleranceInfo(bee.getGenome().getToleranceTemp(), COLUMN_1,
|
||||
getColorCoding(bee.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()).isDominant()));
|
||||
drawToleranceInfo(((AlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal())).getValue(), COLUMN_2,
|
||||
getColorCoding(bee.getGenome().getInactiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()).isDominant()));
|
||||
drawToleranceInfo(tempToleranceActive, COLUMN_1);
|
||||
drawToleranceInfo(tempToleranceInactive, COLUMN_2);
|
||||
|
||||
newLine();
|
||||
|
||||
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());
|
||||
drawLine(StringUtil.localize("gui.humidtol"), COLUMN_0);
|
||||
drawToleranceInfo(bee.getGenome().getToleranceHumid(), COLUMN_1,
|
||||
getColorCoding(bee.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()).isDominant()));
|
||||
drawToleranceInfo(((AlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal())).getValue(), COLUMN_2,
|
||||
getColorCoding(bee.getGenome().getInactiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()).isDominant()));
|
||||
drawToleranceInfo(humidToleranceActive, COLUMN_1);
|
||||
drawToleranceInfo(humidToleranceInactive, COLUMN_2);
|
||||
|
||||
newLine();
|
||||
newLine();
|
||||
|
||||
@@ -10,14 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import forestry.core.utils.StringUtil;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.apiculture.genetics.BeeGenome;
|
||||
import forestry.apiculture.items.ItemBeeGE;
|
||||
import forestry.apiculture.items.ItemImprinter.ImprinterInventory;
|
||||
import forestry.core.config.Defaults;
|
||||
@@ -25,7 +19,12 @@ import forestry.core.config.ForestryItem;
|
||||
import forestry.core.gadgets.TileForestry;
|
||||
import forestry.core.gui.GuiForestry;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class GuiImprinter extends GuiForestry<TileForestry> {
|
||||
|
||||
@@ -49,7 +48,7 @@ public class GuiImprinter extends GuiForestry<TileForestry> {
|
||||
ArrayList<ItemStack> beeList = new ArrayList<ItemStack>();
|
||||
((ItemBeeGE) ForestryItem.beeDroneGE.item()).addCreativeItems(beeList, false);
|
||||
for (ItemStack beeStack : beeList)
|
||||
iconStacks.put(PluginApiculture.beeInterface.getMember(beeStack).getIdent(), beeStack);
|
||||
iconStacks.put(BeeGenome.getSpecies(beeStack).getUID(), beeStack);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,19 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
@@ -33,11 +22,20 @@ import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.apiculture.genetics.Bee;
|
||||
import forestry.apiculture.genetics.BeeGenome;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.genetics.ItemGE;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemBeeGE extends ItemGE {
|
||||
|
||||
@@ -56,6 +54,11 @@ public class ItemBeeGE extends ItemGE {
|
||||
return new Bee(itemstack.getTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IAlleleSpecies getSpecies(ItemStack itemStack) {
|
||||
return BeeGenome.getSpecies(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDefaultPrimaryColour() {
|
||||
return 0xffffff;
|
||||
@@ -74,7 +77,7 @@ public class ItemBeeGE extends ItemGE {
|
||||
|
||||
IBee individual = new Bee(itemstack.getTagCompound());
|
||||
String customBeeKey = "bees.custom." + type.getName() + "." + individual.getGenome().getPrimary().getUnlocalizedName().replace("bees.species.","");
|
||||
if(StatCollector.canTranslate("for." + customBeeKey)){
|
||||
if(StringUtil.canTranslate(customBeeKey)){
|
||||
return StringUtil.localize(customBeeKey);
|
||||
}
|
||||
String beeGrammar = StringUtil.localize("bees.grammar." + type.getName());
|
||||
@@ -131,7 +134,7 @@ public class ItemBeeGE extends ItemGE {
|
||||
if (!itemstack.hasTagCompound())
|
||||
return super.getColorFromItemStack(itemstack, renderPass);
|
||||
|
||||
return getColourFromSpecies(PluginApiculture.beeInterface.getMember(itemstack).getGenome().getPrimary(), renderPass);
|
||||
return getColourFromSpecies(BeeGenome.getSpecies(itemstack), renderPass);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -166,7 +169,7 @@ public class ItemBeeGE extends ItemGE {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack itemstack, int renderPass) {
|
||||
return getIconFromSpecies(PluginApiculture.beeInterface.getMember(itemstack).getGenome().getPrimary(), renderPass);
|
||||
return getIconFromSpecies(BeeGenome.getSpecies(itemstack), renderPass);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -10,14 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.trigger;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import forestry.apiculture.gadgets.TileApiary;
|
||||
import forestry.core.triggers.Trigger;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TriggerNoFrames extends Trigger {
|
||||
|
||||
@@ -29,7 +27,7 @@ public class TriggerNoFrames extends Trigger {
|
||||
* Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
*/
|
||||
@Override
|
||||
public boolean isTriggerActive(ForgeDirection direction, TileEntity tile, ITriggerParameter parameter) {
|
||||
public boolean isTriggerActive(TileEntity tile, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
|
||||
if (!(tile instanceof TileApiary))
|
||||
return false;
|
||||
|
||||
@@ -10,17 +10,23 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveManager;
|
||||
import forestry.api.apiculture.hives.IHive;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType;
|
||||
import net.minecraftforge.event.terraingen.TerrainGen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info/>
|
||||
@@ -30,13 +36,6 @@ public class HiveDecorator {
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final EventType EVENT_TYPE = EnumHelper.addEnum(EventType.class, "FORESTRY_HIVES", new Class[0], new Object[0]);
|
||||
private static HiveDecorator instance;
|
||||
private final WorldGenHiveForest forest = new WorldGenHiveForest();
|
||||
private final WorldGenHiveJungle jungle = new WorldGenHiveJungle();
|
||||
private final WorldGenHiveMeadows meadows = new WorldGenHiveMeadows();
|
||||
private final WorldGenHiveParched parched = new WorldGenHiveParched();
|
||||
private final WorldGenHiveEnd end = new WorldGenHiveEnd();
|
||||
private final WorldGenHiveSnow snow = new WorldGenHiveSnow();
|
||||
private final WorldGenHiveSwamp swamp = new WorldGenHiveSwamp();
|
||||
|
||||
public static HiveDecorator instance() {
|
||||
if (instance == null) {
|
||||
@@ -57,22 +56,79 @@ public class HiveDecorator {
|
||||
}
|
||||
|
||||
private void decorateHives(World world, Random rand, int worldX, int worldZ) {
|
||||
genHive(world, rand, worldX, worldZ, 42, 3, forest);
|
||||
genHive(world, rand, worldX, worldZ, 62, 4, jungle);
|
||||
genHive(world, rand, worldX, worldZ, 42, 1, meadows);
|
||||
genHive(world, rand, worldX, worldZ, 42, 1, parched);
|
||||
genHive(world, rand, worldX, worldZ, 42, 4, end);
|
||||
genHive(world, rand, worldX, worldZ, 42, 2, snow);
|
||||
genHive(world, rand, worldX, worldZ, 42, 2, swamp);
|
||||
for (IHive hive : HiveManager.getHives())
|
||||
if (Config.generateBeehivesDebug)
|
||||
genHiveDebug(world, worldX, worldZ, hive);
|
||||
else
|
||||
genHive(world, rand, worldX, worldZ, hive);
|
||||
}
|
||||
|
||||
private void genHive(World world, Random rand, int worldX, int worldZ, int height, int attempts, WorldGenHive gen) {
|
||||
for (int i = 0; i < attempts; i++) {
|
||||
int randPosX = worldX + rand.nextInt(16);
|
||||
int randPosY = height + rand.nextInt(50);
|
||||
int randPosZ = worldZ + rand.nextInt(16);
|
||||
if (gen.generate(world, rand, randPosX, randPosY, randPosZ))
|
||||
private void genHive(World world, Random rand, int worldX, int worldZ, IHive hive) {
|
||||
if (hive.genChance() < rand.nextFloat() * 128.0f)
|
||||
return;
|
||||
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(worldX, worldZ);
|
||||
EnumHumidity humidity = EnumHumidity.getFromValue(biome.rainfall);
|
||||
|
||||
if (!hive.isGoodBiome(biome) || !hive.isGoodHumidity(humidity))
|
||||
return;
|
||||
|
||||
for (int tries = 0; tries < 4; tries ++) {
|
||||
int x = worldX + rand.nextInt(16);
|
||||
int z = worldZ + rand.nextInt(16);
|
||||
|
||||
if (tryGenHive(world, x, z, hive))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void genHiveDebug(World world, int worldX, int worldZ, IHive hive) {
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(worldX, worldZ);
|
||||
EnumHumidity humidity = EnumHumidity.getFromValue(biome.rainfall);
|
||||
|
||||
if (!hive.isGoodBiome(biome) || !hive.isGoodHumidity(humidity))
|
||||
return;
|
||||
|
||||
for (int x = 0; x < 16; x++)
|
||||
for (int z = 0; z < 16; z++)
|
||||
tryGenHive(world, worldX + x, worldZ + z, hive);
|
||||
}
|
||||
|
||||
private boolean tryGenHive(World world, int x, int z, IHive hive) {
|
||||
|
||||
int y = hive.getYForHive(world, x, z);
|
||||
|
||||
if (y < 0)
|
||||
return false;
|
||||
|
||||
if (!hive.canReplace(world, x, y, z))
|
||||
return false;
|
||||
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
||||
EnumTemperature temperature = EnumTemperature.getFromValue(biome.getFloatTemperature(x, y, z));
|
||||
if (!hive.isGoodTemperature(temperature))
|
||||
return false;
|
||||
|
||||
if (!hive.isGoodLocation(world, x, y, z))
|
||||
return false;
|
||||
|
||||
return setHive(world, x, y, z, hive);
|
||||
}
|
||||
|
||||
protected boolean setHive(World world, int x, int y, int z, IHive hive) {
|
||||
Block hiveBlock = hive.getHiveBlock();
|
||||
boolean placed = world.setBlock(x, y, z, hiveBlock, hive.getHiveMeta(), Defaults.FLAG_BLOCK_SYNCH);
|
||||
if (!placed)
|
||||
return false;
|
||||
|
||||
Block placedBlock = world.getBlock(x, y, z);
|
||||
if (!Block.isEqualTo(hiveBlock, placedBlock))
|
||||
return false;
|
||||
|
||||
hiveBlock.onBlockAdded(world, x, y, z);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
|
||||
hive.postGen(world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+12
-12
@@ -4,27 +4,27 @@
|
||||
* 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.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveGround;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class WorldGenHiveEnd extends WorldGenHive {
|
||||
public class HiveEnd extends HiveGround {
|
||||
|
||||
public HiveEnd(float genChance) {
|
||||
super(ForestryBlock.beehives.block(), 5, genChance, Blocks.end_stone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (biome.biomeID != BiomeGenBase.sky.biomeID)
|
||||
return false;
|
||||
|
||||
return tryPlaceGroundHive(world, x, y, z, 5, Blocks.end_stone);
|
||||
public boolean isGoodBiome(BiomeGenBase biome) {
|
||||
return biome.biomeID == BiomeGenBase.sky.biomeID;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+15
-14
@@ -4,30 +4,31 @@
|
||||
* 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.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveTree;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class WorldGenHiveJungle extends WorldGenHive {
|
||||
public class HiveForest extends HiveTree {
|
||||
|
||||
public HiveForest(float genChance) {
|
||||
super(ForestryBlock.beehives.block(), 1, genChance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
public boolean isGoodHumidity(EnumHumidity humidity) {
|
||||
return humidity == EnumHumidity.NORMAL;
|
||||
}
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (EnumTemperature.getFromValue(biome.temperature) != EnumTemperature.WARM
|
||||
|| EnumHumidity.getFromValue(biome.rainfall) != EnumHumidity.DAMP)
|
||||
return false;
|
||||
|
||||
return tryPlaceTreeHive(world, x, y, z, 4);
|
||||
@Override
|
||||
public boolean isGoodTemperature(EnumTemperature temperature) {
|
||||
return temperature == EnumTemperature.NORMAL;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+16
-16
@@ -4,31 +4,31 @@
|
||||
* 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.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveTree;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class WorldGenHiveForest extends WorldGenHive {
|
||||
public class HiveJungle extends HiveTree {
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (EnumTemperature.getFromValue(biome.temperature) != EnumTemperature.NORMAL ||
|
||||
EnumHumidity.getFromValue(biome.rainfall) != EnumHumidity.NORMAL)
|
||||
return false;
|
||||
|
||||
return tryPlaceTreeHive(world, x, y, z, 1);
|
||||
public HiveJungle(float genChance) {
|
||||
super(ForestryBlock.beehives.block(), 4, genChance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGoodHumidity(EnumHumidity humidity) {
|
||||
return humidity == EnumHumidity.DAMP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGoodTemperature(EnumTemperature temperature) {
|
||||
return temperature == EnumTemperature.WARM;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+16
-15
@@ -4,31 +4,32 @@
|
||||
* 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.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveGround;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class WorldGenHiveSwamp extends WorldGenHive {
|
||||
public class HiveMeadows extends HiveGround {
|
||||
|
||||
public HiveMeadows(float genChance) {
|
||||
super(ForestryBlock.beehives.block(), 2, genChance, Blocks.dirt, Blocks.grass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
public boolean isGoodHumidity(EnumHumidity humidity) {
|
||||
return humidity == EnumHumidity.NORMAL;
|
||||
}
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (EnumTemperature.getFromValue(biome.temperature) != EnumTemperature.NORMAL
|
||||
|| EnumHumidity.getFromValue(biome.rainfall) != EnumHumidity.DAMP)
|
||||
return false;
|
||||
|
||||
return tryPlaceGroundHive(world, x, y, z, 7, Blocks.dirt, Blocks.grass);
|
||||
@Override
|
||||
public boolean isGoodTemperature(EnumTemperature temperature) {
|
||||
return temperature == EnumTemperature.NORMAL;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+16
-15
@@ -4,31 +4,32 @@
|
||||
* 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.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveGround;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class WorldGenHiveParched extends WorldGenHive {
|
||||
public class HiveParched extends HiveGround {
|
||||
|
||||
public HiveParched(float genChance) {
|
||||
super(ForestryBlock.beehives.block(), 3, genChance, Blocks.sand, Blocks.sandstone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
public boolean isGoodHumidity(EnumHumidity humidity) {
|
||||
return humidity == EnumHumidity.ARID;
|
||||
}
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (EnumTemperature.getFromValue(biome.temperature) != EnumTemperature.HOT
|
||||
|| EnumHumidity.getFromValue(biome.rainfall) != EnumHumidity.ARID)
|
||||
return false;
|
||||
|
||||
return tryPlaceGroundHive(world, x, y, z, 3, Blocks.sand, Blocks.sandstone);
|
||||
@Override
|
||||
public boolean isGoodTemperature(EnumTemperature temperature) {
|
||||
return temperature == EnumTemperature.HOT;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+15
-16
@@ -4,35 +4,34 @@
|
||||
* 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.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveGround;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.core.EnumTemperature;
|
||||
public class HiveSnow extends HiveGround {
|
||||
|
||||
public class WorldGenHiveSnow extends WorldGenHive {
|
||||
public HiveSnow(float genChance) {
|
||||
super(ForestryBlock.beehives.block(), 6, genChance, Blocks.dirt, Blocks.grass, Blocks.snow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
public boolean isGoodTemperature(EnumTemperature temperature) {
|
||||
return temperature == EnumTemperature.COLD || temperature == EnumTemperature.ICY;
|
||||
}
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (EnumTemperature.getFromValue(biome.temperature) != EnumTemperature.ICY
|
||||
&& EnumTemperature.getFromValue(biome.temperature) != EnumTemperature.COLD)
|
||||
return false;
|
||||
|
||||
if (tryPlaceGroundHive(world, x, y, z, 6, Blocks.dirt, Blocks.grass)) {
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z) {
|
||||
if (world.isAirBlock(x, y + 1, z))
|
||||
world.setBlock(x, y + 1, z, Blocks.snow_layer, 0, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+16
-15
@@ -4,31 +4,32 @@
|
||||
* 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.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveGround;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class WorldGenHiveMeadows extends WorldGenHive {
|
||||
public class HiveSwamp extends HiveGround {
|
||||
|
||||
public HiveSwamp(float genChance) {
|
||||
super(ForestryBlock.beehives.block(), 7, genChance, Blocks.dirt, Blocks.grass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
public boolean isGoodHumidity(EnumHumidity humidity) {
|
||||
return humidity == EnumHumidity.DAMP;
|
||||
}
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (EnumTemperature.getFromValue(biome.temperature) != EnumTemperature.NORMAL
|
||||
|| EnumHumidity.getFromValue(biome.rainfall) != EnumHumidity.NORMAL)
|
||||
return false;
|
||||
|
||||
return tryPlaceGroundHive(world, x, y, z, 2, Blocks.dirt, Blocks.grass);
|
||||
@Override
|
||||
public boolean isGoodTemperature(EnumTemperature temperature) {
|
||||
return temperature == EnumTemperature.NORMAL;
|
||||
}
|
||||
}
|
||||
@@ -12,13 +12,9 @@ package forestry.apiculture.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
|
||||
@@ -27,49 +23,6 @@ public abstract class WorldGenHive extends WorldGenerator {
|
||||
@Override
|
||||
public abstract boolean generate(World world, Random random, int x, int y, int z);
|
||||
|
||||
protected boolean tryPlaceTreeHive(World world, int x, int y, int z, int meta) {
|
||||
if (!world.isAirBlock(x, y, z))
|
||||
return false;
|
||||
|
||||
Block b = world.getBlock(x, y + 1, z);
|
||||
if (b == null || !b.isLeaves(world, x, y + 1, z))
|
||||
return false;
|
||||
|
||||
if (world.isAirBlock(x, y - 1, z)) {
|
||||
setHive(world, x, y, z, meta);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean tryPlaceGroundHive(World world, int x, int y, int z, int meta, Block... groundBlocks) {
|
||||
if (!world.isAirBlock(x, y, z)) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block != Blocks.snow_layer && !(block instanceof IPlantable))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!world.isAirBlock(x, y + 1, z))
|
||||
return false;
|
||||
|
||||
if (isAcceptableBlock(world, x, y - 1, z, groundBlocks)) {
|
||||
setHive(world, x, y, z, meta);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isAcceptableBlock(World world, int x, int y, int z, Block... blocks) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block == null)
|
||||
return false;
|
||||
for (Block testBlock : blocks)
|
||||
if (block.isReplaceableOreGen(world, x, y, z, testBlock))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void setHive(World world, int x, int y, int z, int meta) {
|
||||
boolean placed = world.setBlock(x, y, z, ForestryBlock.beehives.block(), meta, Defaults.FLAG_BLOCK_SYNCH);
|
||||
if (!placed)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture;
|
||||
|
||||
public interface IWoodFireproof {
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*******************************************************************************
|
||||
* 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.arboriculture.gadgets;
|
||||
|
||||
import forestry.arboriculture.IWoodFireproof;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockFireproofLog extends BlockLog implements IWoodFireproof {
|
||||
|
||||
public static Material fireproofWood = new Material(MapColor.woodColor);
|
||||
|
||||
public BlockFireproofLog(LogCat cat) {
|
||||
super(cat, fireproofWood);
|
||||
}
|
||||
|
||||
public static ForestryBlock getFireproofLog(BlockLog log) {
|
||||
return getFireproofLog(log.cat);
|
||||
}
|
||||
|
||||
private static ForestryBlock getFireproofLog(BlockLog.LogCat logCat) {
|
||||
switch (logCat) {
|
||||
case CAT0: return ForestryBlock.fireproofLog1;
|
||||
case CAT1: return ForestryBlock.fireproofLog2;
|
||||
case CAT2: return ForestryBlock.fireproofLog3;
|
||||
case CAT3: return ForestryBlock.fireproofLog4;
|
||||
case CAT4: return ForestryBlock.fireproofLog5;
|
||||
case CAT5: return ForestryBlock.fireproofLog6;
|
||||
case CAT6: return ForestryBlock.fireproofLog7;
|
||||
case CAT7: return ForestryBlock.fireproofLog8;
|
||||
}
|
||||
throw new IllegalArgumentException("No fireproof log for this category: " + logCat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*******************************************************************************
|
||||
* 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.arboriculture.gadgets;
|
||||
|
||||
import forestry.arboriculture.IWoodFireproof;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockFireproofPlanks extends BlockPlanks implements IWoodFireproof {
|
||||
|
||||
public static Material fireproofWood = new Material(MapColor.woodColor);
|
||||
|
||||
public BlockFireproofPlanks(PlankCat cat) {
|
||||
super(cat, fireproofWood);
|
||||
}
|
||||
|
||||
public static ForestryBlock getFireproofPlanks(BlockPlanks planks) {
|
||||
return getFireproofPlanks(planks.cat);
|
||||
}
|
||||
|
||||
private static ForestryBlock getFireproofPlanks(PlankCat plankCat) {
|
||||
switch (plankCat) {
|
||||
case CAT0: return ForestryBlock.fireproofPlanks1;
|
||||
case CAT1: return ForestryBlock.fireproofPlanks2;
|
||||
}
|
||||
throw new IllegalArgumentException("No fireproof log for this category: " + plankCat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,18 +38,20 @@ public class BlockLog extends Block implements IWoodTyped {
|
||||
CAT0, CAT1, CAT2, CAT3, CAT4, CAT5, CAT6, CAT7
|
||||
}
|
||||
|
||||
private final LogCat cat;
|
||||
protected final LogCat cat;
|
||||
|
||||
public BlockLog(LogCat cat) {
|
||||
this(cat, Material.wood);
|
||||
}
|
||||
|
||||
super(Material.wood);
|
||||
protected BlockLog(LogCat cat, Material material) {
|
||||
super(material);
|
||||
this.cat = cat;
|
||||
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setStepSound(soundTypeWood);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
|
||||
}
|
||||
|
||||
public static int getTypeFromMeta(int damage) {
|
||||
|
||||
@@ -37,10 +37,14 @@ public class BlockPlanks extends Block implements IWoodTyped {
|
||||
CAT0, CAT1
|
||||
}
|
||||
|
||||
private final PlankCat cat;
|
||||
protected final PlankCat cat;
|
||||
|
||||
public BlockPlanks(PlankCat cat) {
|
||||
super(Material.wood);
|
||||
this(cat, Material.wood);
|
||||
}
|
||||
|
||||
protected BlockPlanks(PlankCat cat, Material material) {
|
||||
super(material);
|
||||
this.cat = cat;
|
||||
setResistance(5.0F);
|
||||
setStepSound(soundTypeWood);
|
||||
|
||||
@@ -189,9 +189,15 @@ public class ForestryBlockLeaves extends BlockNewLeaf implements ITileEntityProv
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
if (getLeafTile(world, x, y, z).isDecorative())
|
||||
TileLeaves tileLeaves = getLeafTile(world, x, y, z);
|
||||
if (tileLeaves == null || tileLeaves.isDecorative())
|
||||
return;
|
||||
|
||||
super.updateTick(world, x, y, z, random);
|
||||
|
||||
if (world.rand.nextFloat() > 0.1)
|
||||
return;
|
||||
tileLeaves.onBlockTick();
|
||||
}
|
||||
|
||||
/* RENDERING */
|
||||
|
||||
@@ -96,7 +96,7 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
maturationTime = nbttagcompound.getInteger("CATMAT");
|
||||
caterpillar = (IButterfly)AlleleManager.alleleRegistry.getSpeciesRoot("rootButterflies").getMember(nbttagcompound.getCompoundTag("CATER"));
|
||||
}
|
||||
|
||||
isDecorative = nbttagcompound.getBoolean("Decorative");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,7 +114,7 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
caterpillar.writeToNBT(subcompound);
|
||||
nbttagcompound.setTag("CATER", subcompound);
|
||||
}
|
||||
|
||||
nbttagcompound.setBoolean("Decorative", isDecorative);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.genetics;
|
||||
|
||||
import forestry.core.utils.StringUtil;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -39,8 +38,8 @@ public class AlleleLeafEffectNone extends Allele implements IAlleleLeafEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return StringUtil.localize("arboriculture.effect.none");
|
||||
public String getUnlocalizedName() {
|
||||
return "arboriculture.effect.none";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,6 @@ package forestry.arboriculture.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -254,7 +253,7 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getGermlingIcon(EnumGermlingType type, int renderPass) {
|
||||
if(type == EnumGermlingType.POLLEN)
|
||||
return ForestryItem.pollen.item().getIconFromDamageForRenderPass(0, renderPass);
|
||||
return ForestryItem.pollenCluster.item().getIconFromDamageForRenderPass(0, renderPass);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
@@ -10,24 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.arboriculture.EnumGrowthConditions;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.arboriculture.IAlleleLeafEffect;
|
||||
@@ -37,6 +20,7 @@ import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.ITreeMutation;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleBoolean;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
@@ -47,6 +31,21 @@ import forestry.core.genetics.Chromosome;
|
||||
import forestry.core.genetics.Individual;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
public class Tree extends Individual implements ITree, ITreeGenData, IPlantable {
|
||||
|
||||
@@ -285,6 +284,10 @@ public class Tree extends Individual implements ITree, ITreeGenData, IPlantable
|
||||
|
||||
list.add(String.format("\u00A7eS: %s, \u00A7fY: %s", genome.getActiveAllele(EnumTreeChromosome.FERTILITY.ordinal()).getName(), genome.getActiveAllele(EnumTreeChromosome.YIELD.ordinal()).getName()));
|
||||
|
||||
IAlleleBoolean primaryFireproof = (IAlleleBoolean)genome.getActiveAllele(EnumTreeChromosome.FIREPROOF.ordinal());
|
||||
if (primaryFireproof.getValue())
|
||||
list.add(String.format("\u00A7c%s", StatCollector.translateToLocal("for.gui.fireresist")));
|
||||
|
||||
IAllele fruit = getGenome().getActiveAllele(EnumTreeChromosome.FRUITS.ordinal());
|
||||
if(fruit != Allele.fruitNone) {
|
||||
String strike = "";
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.arboriculture.genetics;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
@@ -45,6 +46,15 @@ public class TreeGenome extends Genome implements ITreeGenome {
|
||||
super(nbttagcompound);
|
||||
}
|
||||
|
||||
// NBT RETRIEVAL
|
||||
public static IAlleleTreeSpecies getSpecies(ItemStack itemStack) {
|
||||
IAllele speciesAllele = Genome.getPrimaryAllele(itemStack, EnumTreeChromosome.SPECIES);
|
||||
if (speciesAllele instanceof IAlleleTreeSpecies)
|
||||
return (IAlleleTreeSpecies)speciesAllele;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleTreeSpecies getPrimary() {
|
||||
return (IAlleleTreeSpecies) getActiveAllele(EnumTreeChromosome.SPECIES.ordinal());
|
||||
|
||||
@@ -80,6 +80,7 @@ public class TreeTemplates {
|
||||
alleles[EnumTreeChromosome.EFFECT.ordinal()] = Allele.leavesNone;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationAverage;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int1;
|
||||
alleles[EnumTreeChromosome.FIREPROOF.ordinal()] = Allele.fireproofFalse;
|
||||
|
||||
return alleles;
|
||||
}
|
||||
@@ -149,6 +150,7 @@ public class TreeTemplates {
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLower;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationSlower;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int3;
|
||||
alleles[EnumTreeChromosome.FIREPROOF.ordinal()] = Allele.fireproofTrue;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
@@ -159,6 +161,7 @@ public class TreeTemplates {
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLowest;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationSlowest;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int4;
|
||||
alleles[EnumTreeChromosome.FIREPROOF.ordinal()] = Allele.fireproofTrue;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,14 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.arboriculture.IAlleleFruit;
|
||||
@@ -29,14 +21,22 @@ import forestry.api.genetics.IAlleleEffect;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.arboriculture.genetics.TreeGenome;
|
||||
import forestry.arboriculture.items.ItemGermlingGE;
|
||||
import forestry.arboriculture.items.ItemTreealyzer.TreealyzerInventory;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.AlleleBoolean;
|
||||
import forestry.core.genetics.AllelePlantType;
|
||||
import forestry.core.gui.GuiAlyzer;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
public class GuiTreealyzer extends GuiAlyzer {
|
||||
|
||||
@@ -50,8 +50,8 @@ public class GuiTreealyzer extends GuiAlyzer {
|
||||
|
||||
ArrayList<ItemStack> treeList = new ArrayList<ItemStack>();
|
||||
((ItemGermlingGE) ForestryItem.sapling.item()).addCreativeItems(treeList, false);
|
||||
for (ItemStack beeStack : treeList)
|
||||
iconStacks.put(PluginArboriculture.treeInterface.getMember(beeStack).getIdent(), beeStack);
|
||||
for (ItemStack treeStack : treeList)
|
||||
iconStacks.put(TreeGenome.getSpecies(treeStack).getUID(), treeStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,6 +174,18 @@ public class GuiTreealyzer extends GuiAlyzer {
|
||||
|
||||
newLine();
|
||||
|
||||
String yes = StringUtil.localize("yes");
|
||||
String no = StringUtil.localize("no");
|
||||
|
||||
AlleleBoolean primaryFireproof = (AlleleBoolean)tree.getGenome().getActiveAllele(EnumTreeChromosome.FIREPROOF.ordinal());
|
||||
AlleleBoolean secondaryFireproof = (AlleleBoolean)tree.getGenome().getInactiveAllele(EnumTreeChromosome.FIREPROOF.ordinal());
|
||||
|
||||
drawLine(StringUtil.localize("gui.fireproof"), COLUMN_0);
|
||||
drawLine(StringUtil.readableBoolean(primaryFireproof.getValue(), yes, no), COLUMN_1, tree, EnumTreeChromosome.FIREPROOF, false);
|
||||
drawLine(StringUtil.readableBoolean(secondaryFireproof.getValue(), yes, no), COLUMN_2, tree, EnumTreeChromosome.FIREPROOF, false);
|
||||
|
||||
newLine();
|
||||
|
||||
drawRow(StringUtil.localize("gui.effect"), tree.getGenome().getEffect().getName(),
|
||||
((IAlleleEffect) tree.getGenome().getInactiveAllele(EnumTreeChromosome.EFFECT.ordinal())).getName(), tree,
|
||||
EnumTreeChromosome.EFFECT);
|
||||
|
||||
@@ -10,37 +10,36 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.api.recipes.IVariableFermentable;
|
||||
import forestry.arboriculture.genetics.Tree;
|
||||
import forestry.arboriculture.genetics.TreeGenome;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.genetics.ItemGE;
|
||||
import forestry.core.network.PacketFXSignal;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.SpriteSheet;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.api.recipes.IVariableFermentable;
|
||||
import forestry.arboriculture.genetics.Tree;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.genetics.ItemGE;
|
||||
import forestry.core.network.PacketFXSignal;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.SpriteSheet;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemGermlingGE extends ItemGE implements IVariableFermentable {
|
||||
|
||||
@@ -57,12 +56,17 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable {
|
||||
return new Tree(itemstack.getTagCompound());
|
||||
}
|
||||
|
||||
private IAlleleTreeSpecies getPrimarySpecies(ItemStack itemstack) {
|
||||
ITree tree = PluginArboriculture.treeInterface.getMember(itemstack);
|
||||
if (tree == null)
|
||||
return (IAlleleTreeSpecies) PluginArboriculture.treeInterface.getDefaultTemplate()[EnumTreeChromosome.SPECIES.ordinal()];
|
||||
else
|
||||
return tree.getGenome().getPrimary();
|
||||
@Override
|
||||
protected IAlleleTreeSpecies getSpecies(ItemStack itemStack) {
|
||||
return TreeGenome.getSpecies(itemStack);
|
||||
}
|
||||
|
||||
private IAlleleTreeSpecies getSpeciesOrDefault(ItemStack itemstack) {
|
||||
IAlleleTreeSpecies treeSpecies = TreeGenome.getSpecies(itemstack);
|
||||
if (treeSpecies == null)
|
||||
treeSpecies = (IAlleleTreeSpecies) PluginArboriculture.treeInterface.getDefaultTemplate()[EnumTreeChromosome.SPECIES.ordinal()];
|
||||
|
||||
return treeSpecies;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,12 +83,13 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable {
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
if (!itemstack.hasTagCompound())
|
||||
return "Unknown";
|
||||
IIndividual individual = getIndividual(itemstack);
|
||||
String customTreeKey = "trees.custom." + type.getName() + "." + individual.getGenome().getPrimary().getUnlocalizedName().replace("trees.species.","");
|
||||
if(StatCollector.canTranslate("for." + customTreeKey)){
|
||||
IAlleleSpecies species = getSpecies(itemstack);
|
||||
|
||||
String customTreeKey = "trees.custom." + type.getName() + "." + species.getUnlocalizedName().replace("trees.species.","");
|
||||
if(StringUtil.canTranslate(customTreeKey)){
|
||||
return StringUtil.localize(customTreeKey);
|
||||
}
|
||||
return StringUtil.localize("trees.grammar." + type.getName()).replaceAll("%SPECIES", individual.getDisplayName()).replaceAll("%TYPE", StringUtil.localize("trees.grammar." + type.getName() + ".type"));
|
||||
return StringUtil.localize("trees.grammar." + type.getName()).replaceAll("%SPECIES", species.getName()).replaceAll("%TYPE", StringUtil.localize("trees.grammar." + type.getName() + ".type"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -106,7 +111,7 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable {
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
|
||||
return getPrimarySpecies(itemstack).getGermlingColour(type, renderPass);
|
||||
return getSpeciesOrDefault(itemstack).getGermlingColour(type, renderPass);
|
||||
}
|
||||
|
||||
/* ICONS */
|
||||
@@ -128,7 +133,7 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack itemstack, int renderPass) {
|
||||
IAlleleTreeSpecies species = getPrimarySpecies(itemstack);
|
||||
IAlleleTreeSpecies species = getSpeciesOrDefault(itemstack);
|
||||
return species.getGermlingIcon(type, renderPass);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ItemLeavesBlock extends ItemForestryBlock {
|
||||
return type;
|
||||
ITree tree = getTree(itemstack);
|
||||
String customTreeKey = "trees.custom.leaves." + tree.getGenome().getPrimary().getUnlocalizedName().replace("trees.species.","");
|
||||
if(StatCollector.canTranslate("for." + customTreeKey)){
|
||||
if(StringUtil.canTranslate(customTreeKey)){
|
||||
return StringUtil.localize(customTreeKey);
|
||||
}
|
||||
String grammar = StringUtil.localize("trees.grammar.leaves");
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.items;
|
||||
|
||||
import forestry.arboriculture.IWoodFireproof;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -23,22 +25,23 @@ public class ItemWoodBlock extends ItemForestryBlock {
|
||||
super(block);
|
||||
}
|
||||
|
||||
public static int getTypeFromMeta(int damage) {
|
||||
return damage & 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack) {
|
||||
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
if (this.getBlock() instanceof IWoodTyped) {
|
||||
IWoodTyped block = (IWoodTyped) getBlock();
|
||||
int meta = itemstack.getItemDamage();
|
||||
WoodType woodType = block.getWoodType(meta);
|
||||
if (woodType == null)
|
||||
return null;
|
||||
return "tile.for." + block.getBlockKind() + "." + woodType.ordinal();
|
||||
}
|
||||
return super.getUnlocalizedName(itemstack);
|
||||
}
|
||||
|
||||
String unlocalizedName = block.getBlockKind() + "." + woodType.ordinal() + ".name";
|
||||
String displayName = StringUtil.localizeTile(unlocalizedName);
|
||||
|
||||
if (this.getBlock() instanceof IWoodFireproof)
|
||||
displayName = StringUtil.localizeAndFormatRaw("tile.for.fireproof", displayName);
|
||||
|
||||
return displayName;
|
||||
}
|
||||
return super.getItemStackDisplayName(itemstack);
|
||||
}
|
||||
}
|
||||
@@ -52,10 +52,10 @@ public class FruitPodRenderingHandler implements ISimpleBlockRenderingHandler {
|
||||
double d1 = 15.0D;
|
||||
double d2 = 4.0D;
|
||||
double d3 = 4.0D + l1;
|
||||
double d4 = (double)podIcon.getInterpolatedU(d0);
|
||||
double d5 = (double)podIcon.getInterpolatedU(d1);
|
||||
double d6 = (double)podIcon.getInterpolatedV(d2);
|
||||
double d7 = (double)podIcon.getInterpolatedV(d3);
|
||||
double d4 = (double) podIcon.getInterpolatedU(d0);
|
||||
double d5 = (double) podIcon.getInterpolatedU(d1);
|
||||
double d6 = (double) podIcon.getInterpolatedV(d2);
|
||||
double d7 = (double) podIcon.getInterpolatedV(d3);
|
||||
double d8 = 0.0D;
|
||||
double d9 = 0.0D;
|
||||
|
||||
@@ -104,10 +104,10 @@ public class FruitPodRenderingHandler implements ISimpleBlockRenderingHandler {
|
||||
if (maturity >= 2)
|
||||
i2 = k1 - 1;
|
||||
|
||||
d4 = (double)podIcon.getMinU();
|
||||
d5 = (double)podIcon.getInterpolatedU((double)i2);
|
||||
d6 = (double)podIcon.getMinV();
|
||||
d7 = (double)podIcon.getInterpolatedV((double)i2);
|
||||
d4 = (double) podIcon.getMinU();
|
||||
d5 = (double) podIcon.getInterpolatedU((double) i2);
|
||||
d6 = (double) podIcon.getMinV();
|
||||
d7 = (double) podIcon.getInterpolatedV((double) i2);
|
||||
|
||||
tessellator.addVertexWithUV(d10, d13, d15, d4, d7);
|
||||
tessellator.addVertexWithUV(d11, d13, d15, d5, d7);
|
||||
@@ -117,10 +117,10 @@ public class FruitPodRenderingHandler implements ISimpleBlockRenderingHandler {
|
||||
tessellator.addVertexWithUV(d11, d12, d14, d5, d6);
|
||||
tessellator.addVertexWithUV(d11, d12, d15, d5, d7);
|
||||
tessellator.addVertexWithUV(d10, d12, d15, d4, d7);
|
||||
d4 = (double)podIcon.getInterpolatedU(12.0D);
|
||||
d5 = (double)podIcon.getMaxU();
|
||||
d6 = (double)podIcon.getMinV();
|
||||
d7 = (double)podIcon.getInterpolatedV(4.0D);
|
||||
d4 = (double) podIcon.getInterpolatedU(12.0D);
|
||||
d5 = (double) podIcon.getMaxU();
|
||||
d6 = (double) podIcon.getMinV();
|
||||
d7 = (double) podIcon.getInterpolatedV(4.0D);
|
||||
d8 = 8.0D;
|
||||
d9 = 0.0D;
|
||||
double d16;
|
||||
|
||||
@@ -90,10 +90,10 @@ public class SaplingRenderHandler implements ISimpleBlockRenderingHandler {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
IIcon icon = species.getGermlingIcon(EnumGermlingType.SAPLING, renderLayer);
|
||||
|
||||
double d3 = (double)icon.getMinU();
|
||||
double d4 = (double)icon.getMinV();
|
||||
double d5 = (double)icon.getMaxU();
|
||||
double d6 = (double)icon.getMaxV();
|
||||
double d3 = (double) icon.getMinU();
|
||||
double d4 = (double) icon.getMinV();
|
||||
double d5 = (double) icon.getMaxU();
|
||||
double d6 = (double) icon.getMaxV();
|
||||
double d7 = 0.45D * mod;
|
||||
double d8 = par3 + 0.5D - d7;
|
||||
double d9 = par3 + 0.5D + d7;
|
||||
|
||||
@@ -48,10 +48,4 @@ public class WorldGenAcacia extends WorldGenTree {
|
||||
height = determineHeight(5, 2);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log1, 2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,10 +46,4 @@ public class WorldGenBalsa extends WorldGenTree {
|
||||
height = determineHeight(6, 6);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log3, 3);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,10 +64,4 @@ public class WorldGenBaobab extends WorldGenTree {
|
||||
height = determineHeight(6, 6);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log2, 2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,10 +40,4 @@ public class WorldGenCherry extends WorldGenTree {
|
||||
height = determineHeight(4, 4);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log4, 3);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,10 +44,4 @@ public class WorldGenChestnut extends WorldGenTree {
|
||||
height = determineHeight(7, 3);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log2, 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,11 +32,6 @@ public class WorldGenDate extends WorldGenTree {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log5, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preGenerate() {
|
||||
height = determineHeight(6, 2);
|
||||
|
||||
@@ -61,10 +61,4 @@ public class WorldGenEbony extends WorldGenTree {
|
||||
height = determineHeight(10, 4);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log3, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,10 +31,4 @@ public class WorldGenGiganteum extends WorldGenSequoia {
|
||||
height = determineHeight(35, 15);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log7, 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -55,10 +55,4 @@ public class WorldGenGreenheart extends WorldGenTree {
|
||||
height = determineHeight(10, 8);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log4, 2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,10 +54,4 @@ public class WorldGenKapok extends WorldGenTree {
|
||||
height = determineHeight(10, 8);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log3, 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,10 +41,4 @@ public class WorldGenLarch extends WorldGenTree {
|
||||
height = determineHeight(6, 5);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log1, 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,11 +30,6 @@ public class WorldGenLemon extends WorldGenTree {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log6, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preGenerate() {
|
||||
height = determineHeight(6, 3);
|
||||
|
||||
@@ -38,10 +38,4 @@ public class WorldGenLime extends WorldGenTree {
|
||||
height = determineHeight(6, 4);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log1, 3);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,11 +30,6 @@ public class WorldGenMahoe extends WorldGenTree {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log5, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preGenerate() {
|
||||
height = determineHeight(6, 3);
|
||||
|
||||
@@ -43,10 +43,4 @@ public class WorldGenMahogany extends WorldGenTree {
|
||||
height = determineHeight(12, 6);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log3, 2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,10 +44,4 @@ public class WorldGenMaple extends WorldGenTree {
|
||||
height = determineHeight(7, 5);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log6, 2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,11 +29,6 @@ public class WorldGenPapaya extends WorldGenTree {
|
||||
generateSphere(getCenteredAt(yCenter, 0), 2 + rand.nextInt(girth), leaf, EnumReplaceMode.NONE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log5, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preGenerate() {
|
||||
|
||||
@@ -44,10 +44,4 @@ public class WorldGenPine extends WorldGenTree {
|
||||
height = determineHeight(6, 4);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log6, 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,11 +30,6 @@ public class WorldGenPlum extends WorldGenTree {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log6, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preGenerate() {
|
||||
height = determineHeight(6, 3);
|
||||
|
||||
@@ -31,11 +31,6 @@ public class WorldGenPoplar extends WorldGenTree {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log5, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preGenerate() {
|
||||
height = determineHeight(8, 3);
|
||||
|
||||
@@ -55,10 +55,4 @@ public class WorldGenSequoia extends WorldGenTree {
|
||||
height = determineHeight(20, 5);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log2, 3);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,10 +42,4 @@ public class WorldGenSpruce extends WorldGenTree {
|
||||
height = determineHeight(5, 3);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(Blocks.log, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,10 +43,4 @@ public class WorldGenTeak extends WorldGenTree {
|
||||
height = determineHeight(6, 3);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log1, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,9 +12,17 @@ package forestry.arboriculture.worldgen;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.genetics.IAlleleBoolean;
|
||||
import forestry.api.world.ITreeGenData;
|
||||
import forestry.arboriculture.gadgets.BlockFireproofLog;
|
||||
import forestry.arboriculture.gadgets.BlockLog;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.worldgen.BlockType;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public abstract class WorldGenTree extends WorldGenArboriculture {
|
||||
|
||||
@@ -93,6 +101,22 @@ public abstract class WorldGenTree extends WorldGenArboriculture {
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract BlockType getWood();
|
||||
public BlockType getWood() {
|
||||
ItemStack woodStack = tree.getGenome().getPrimary().getLogStacks()[0];
|
||||
|
||||
Block block = StackUtils.getBlock(woodStack);
|
||||
int meta = woodStack.getItemDamage();
|
||||
|
||||
// if we have a fireproof tree, return the fireproof log
|
||||
if (block instanceof BlockLog) {
|
||||
IAlleleBoolean fireproof = (IAlleleBoolean) tree.getGenome().getActiveAllele(EnumTreeChromosome.FIREPROOF.ordinal());
|
||||
if (fireproof.getValue()) {
|
||||
BlockLog blockLog = (BlockLog) block;
|
||||
ForestryBlock fireproofLogBlock = BlockFireproofLog.getFireproofLog(blockLog);
|
||||
return new BlockType(fireproofLogBlock.block(), meta);
|
||||
}
|
||||
}
|
||||
|
||||
return new BlockType(block, meta);
|
||||
}
|
||||
}
|
||||
@@ -46,10 +46,4 @@ public class WorldGenWalnut extends WorldGenTree {
|
||||
height = determineHeight(7, 3);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log4, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,10 +43,4 @@ public class WorldGenWenge extends WorldGenTree {
|
||||
height = determineHeight(6, 2);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log2, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,10 +47,4 @@ public class WorldGenWillow extends WorldGenTree {
|
||||
height = determineHeight(5, 2);
|
||||
girth = determineGirth(tree.getGirth(world, startX, startY, startZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getWood() {
|
||||
return new BlockType(ForestryBlock.log4, 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.CommandMC;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.PluginManager;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class CommandForestry extends CommandMC {
|
||||
|
||||
@@ -137,8 +138,8 @@ public class CommandForestry extends CommandMC {
|
||||
sendChatMessage(sender, "\u00A79Author(s): " + info.author());
|
||||
if (!info.url().isEmpty())
|
||||
sendChatMessage(sender, "\u00A79URL: " + info.url());
|
||||
if (!info.description().isEmpty())
|
||||
sendChatMessage(sender, info.description());
|
||||
if (!info.unlocalizedDescription().isEmpty())
|
||||
sendChatMessage(sender, StatCollector.translateToLocal(info.unlocalizedDescription()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core;
|
||||
|
||||
import forestry.plugins.PluginManager;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -23,9 +24,14 @@ import forestry.core.config.ForestryItem;
|
||||
public class CreativeTabForestry extends CreativeTabs {
|
||||
|
||||
static {
|
||||
Tabs.tabApiculture = new CreativeTabForestry(1, "apiculture");
|
||||
Tabs.tabArboriculture = new CreativeTabForestry(2, "arboriculture");
|
||||
Tabs.tabLepidopterology = new CreativeTabForestry(3, "lepidopterology");
|
||||
if (PluginManager.Module.APICULTURE.isEnabled())
|
||||
Tabs.tabApiculture = new CreativeTabForestry(1, "apiculture");
|
||||
|
||||
if (PluginManager.Module.ARBORICULTURE.isEnabled())
|
||||
Tabs.tabArboriculture = new CreativeTabForestry(2, "arboriculture");
|
||||
|
||||
if (PluginManager.Module.LEPIDOPTEROLOGY.isEnabled())
|
||||
Tabs.tabLepidopterology = new CreativeTabForestry(3, "lepidopterology");
|
||||
}
|
||||
public static final CreativeTabs tabForestry = new CreativeTabForestry(0, "forestry");
|
||||
|
||||
|
||||
@@ -94,7 +94,9 @@ public enum EnumErrorCode {
|
||||
|
||||
NOSUPPLIES("noSupplies", "noResource", 32),
|
||||
|
||||
NOTRADE("noTrade", "noResource", 33);
|
||||
NOTRADE("noTrade", "noResource", 33),
|
||||
|
||||
NOPOWER("noPower", 34);
|
||||
|
||||
private String name;
|
||||
private String iconName;
|
||||
|
||||
@@ -69,8 +69,9 @@ public class CircuitBoard implements ICircuitBoard {
|
||||
if (layout == null)
|
||||
ChipsetManager.circuitRegistry.getDefaultLayout();
|
||||
|
||||
// FIXME: Legacy I
|
||||
ArrayList<ICircuit> readcircuits = new ArrayList<ICircuit>();
|
||||
|
||||
// FIXME: Legacy I
|
||||
if (nbttagcompound.hasKey("CS")) {
|
||||
|
||||
NBTTagList nbttaglist = nbttagcompound.getTagList("CS", 10);
|
||||
@@ -100,12 +101,14 @@ public class CircuitBoard implements ICircuitBoard {
|
||||
if (circuits != null)
|
||||
return;
|
||||
|
||||
circuits = new ICircuit[4];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (!nbttagcompound.hasKey("CA.I" + i))
|
||||
continue;
|
||||
circuits[i] = ChipsetManager.circuitRegistry.getCircuit(nbttagcompound.getString("CA.I" + i));
|
||||
ICircuit circuit = ChipsetManager.circuitRegistry.getCircuit(nbttagcompound.getString("CA.I" + i));
|
||||
if (circuit != null)
|
||||
readcircuits.add(circuit);
|
||||
}
|
||||
circuits = readcircuits.toArray(new ICircuit[readcircuits.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -99,7 +99,6 @@ public class CircuitRegistry implements ICircuitRegistry {
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
registerLayout(new CircuitLayout("engine.tin"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import forestry.core.triggers.ForestryTrigger;
|
||||
public class Config {
|
||||
|
||||
public static final String CATEGORY_COMMON = "common";
|
||||
public static final String CATEGORY_DEBUG = "debug";
|
||||
|
||||
public static Configuration config;
|
||||
|
||||
@@ -57,6 +58,7 @@ public class Config {
|
||||
public static boolean generateTinOre = true;
|
||||
public static boolean generateBeehives = true;
|
||||
public static boolean generateBogEarth = false;
|
||||
public static boolean generateBeehivesDebug = false;
|
||||
|
||||
// Performance
|
||||
public static boolean enableBackpackResupply = true;
|
||||
@@ -148,6 +150,10 @@ public class Config {
|
||||
genBeehives.Comment = "set to false to force forestry to skip generating beehives in the world";
|
||||
generateBeehives = Boolean.parseBoolean(genBeehives.Value);
|
||||
|
||||
Property genDebugBeehives = config.get("world.generate.beehives.debug", CATEGORY_DEBUG, false);
|
||||
genDebugBeehives.Comment = "Set to true to force Forestry to try to generate a beehive at every possible location.";
|
||||
generateBeehivesDebug = Boolean.parseBoolean(genDebugBeehives.Value);
|
||||
|
||||
Property genCopperOre = config.get("world.generate.copper", CATEGORY_COMMON, true);
|
||||
genCopperOre.Comment = "set to false to force forestry to skip generating own copper ore blocks in the world";
|
||||
generateCopperOre = Boolean.parseBoolean(genCopperOre.Value);
|
||||
|
||||
@@ -31,6 +31,7 @@ public class Defaults {
|
||||
|
||||
public static final String DEFAULT_POWER_FRAMEWORK = "forestry.energy.BioPowerFramework";
|
||||
public static final int BUCKET_VOLUME = 1000;
|
||||
public static final int FLUID_PER_HONEY_DROP = 100;
|
||||
|
||||
public static final int[] FACINGS = { 0, 1, 2, 3, 4, 5 };
|
||||
public static final int FACING_UP = 1;
|
||||
|
||||
@@ -41,6 +41,7 @@ public enum ForestryBlock {
|
||||
* 0 - Apatite Ore 1 - Copper Ore 2 - Tin Ore
|
||||
*/
|
||||
resources,
|
||||
resourceStorage,
|
||||
/**
|
||||
* 0 - Legacy 1 - Forest Hive 2 - Meadows Hive
|
||||
*/
|
||||
@@ -51,6 +52,8 @@ public enum ForestryBlock {
|
||||
glass,
|
||||
planks1,
|
||||
planks2,
|
||||
fireproofPlanks1,
|
||||
fireproofPlanks2,
|
||||
slabs1,
|
||||
slabs2,
|
||||
slabs3,
|
||||
@@ -63,6 +66,14 @@ public enum ForestryBlock {
|
||||
log6,
|
||||
log7,
|
||||
log8,
|
||||
fireproofLog1,
|
||||
fireproofLog2,
|
||||
fireproofLog3,
|
||||
fireproofLog4,
|
||||
fireproofLog5,
|
||||
fireproofLog6,
|
||||
fireproofLog7,
|
||||
fireproofLog8,
|
||||
fences1,
|
||||
fences2,
|
||||
stairs,
|
||||
|
||||
@@ -100,7 +100,7 @@ public enum ForestryItem {
|
||||
honeyDrop,
|
||||
scoop,
|
||||
beeswax,
|
||||
pollen,
|
||||
pollenCluster,
|
||||
propolis,
|
||||
honeydew,
|
||||
royalJelly,
|
||||
|
||||
@@ -33,254 +33,262 @@ import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
*/
|
||||
public final class FluidHelper {
|
||||
|
||||
public static final int BUCKET_FILL_TIME = 8;
|
||||
public static final int NETWORK_UPDATE_INTERVAL = 128;
|
||||
public static final int BUCKET_VOLUME = 1000;
|
||||
public static final int BUCKET_FILL_TIME = 8;
|
||||
public static final int NETWORK_UPDATE_INTERVAL = 128;
|
||||
public static final int BUCKET_VOLUME = 1000;
|
||||
|
||||
private FluidHelper() {
|
||||
}
|
||||
private FluidHelper() {
|
||||
}
|
||||
|
||||
public static boolean handleRightClick(IFluidHandler tank, ForgeDirection side, EntityPlayer player, boolean fill, boolean drain) {
|
||||
if (player == null)
|
||||
return false;
|
||||
ItemStack current = player.inventory.getCurrentItem();
|
||||
if (current != null) {
|
||||
public static boolean handleRightClick(IFluidHandler tank, ForgeDirection side, EntityPlayer player, boolean fill, boolean drain) {
|
||||
if (player == null)
|
||||
return false;
|
||||
ItemStack current = player.inventory.getCurrentItem();
|
||||
if (current != null) {
|
||||
|
||||
FluidStack liquid = getFluidStackInContainer(current);
|
||||
FluidStack liquid = getFluidStackInContainer(current);
|
||||
|
||||
if (fill && liquid != null) {
|
||||
int used = tank.fill(side, liquid, true);
|
||||
if (fill && liquid != null) {
|
||||
int used = tank.fill(side, liquid, true);
|
||||
|
||||
if (used > 0) {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, InvTools.depleteItem(current));
|
||||
player.inventory.markDirty();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (used > 0) {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, InvTools.depleteItem(current));
|
||||
player.inventory.markDirty();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} else if (drain) {
|
||||
} else if (drain) {
|
||||
|
||||
FluidStack available = tank.drain(side, Integer.MAX_VALUE, false);
|
||||
if (available != null) {
|
||||
ItemStack filled = fillContainer(available, current);
|
||||
FluidStack available = tank.drain(side, Integer.MAX_VALUE, false);
|
||||
if (available != null) {
|
||||
ItemStack filled = fillContainer(available, current);
|
||||
|
||||
liquid = getFluidStackInContainer(filled);
|
||||
if (liquid != null) {
|
||||
liquid = getFluidStackInContainer(filled);
|
||||
if (liquid != null) {
|
||||
|
||||
if (current.stackSize > 1) {
|
||||
if (!player.inventory.addItemStackToInventory(filled))
|
||||
return false;
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, InvTools.depleteItem(current));
|
||||
player.inventory.markDirty();
|
||||
} else {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, InvTools.depleteItem(current));
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, filled);
|
||||
player.inventory.markDirty();
|
||||
}
|
||||
if (current.stackSize > 1) {
|
||||
if (!player.inventory.addItemStackToInventory(filled))
|
||||
return false;
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, InvTools.depleteItem(current));
|
||||
player.inventory.markDirty();
|
||||
} else {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, InvTools.depleteItem(current));
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, filled);
|
||||
player.inventory.markDirty();
|
||||
}
|
||||
|
||||
tank.drain(side, liquid.amount, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
tank.drain(side, liquid.amount, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void processContainers(StandardTank tank, IInventory inv, int inputSlot, int outputSlot) {
|
||||
processContainers(tank, inv, inputSlot, outputSlot, tank.getFluidType(), true, true);
|
||||
}
|
||||
public static void processContainers(StandardTank tank, IInventory inv, int inputSlot, int outputSlot) {
|
||||
processContainers(tank, inv, inputSlot, outputSlot, tank.getFluidType(), true, true);
|
||||
}
|
||||
|
||||
public static void processContainers(StandardTank tank, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill, boolean processFilled, boolean processEmpty) {
|
||||
TankManager tankManger = new TankManager();
|
||||
tankManger.add(tank);
|
||||
processContainers(tankManger, inv, inputSlot, outputSlot, fluidToFill, processFilled, processEmpty);
|
||||
}
|
||||
public static void processContainers(StandardTank tank, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill, boolean processFilled, boolean processEmpty) {
|
||||
TankManager tankManger = new TankManager();
|
||||
tankManger.add(tank);
|
||||
processContainers(tankManger, inv, inputSlot, outputSlot, fluidToFill, processFilled, processEmpty);
|
||||
}
|
||||
|
||||
public static void processContainers(TankManager tank, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill) {
|
||||
processContainers(tank, inv, inputSlot, outputSlot, fluidToFill, true, true);
|
||||
}
|
||||
public static void processContainers(TankManager tank, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill) {
|
||||
processContainers(tank, inv, inputSlot, outputSlot, fluidToFill, true, true);
|
||||
}
|
||||
|
||||
public static void processContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill, boolean processFilled, boolean processEmpty) {
|
||||
ItemStack input = inv.getStackInSlot(inputSlot);
|
||||
public static void processContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill, boolean processFilled, boolean processEmpty) {
|
||||
ItemStack input = inv.getStackInSlot(inputSlot);
|
||||
|
||||
if (input == null)
|
||||
return;
|
||||
if (input == null)
|
||||
return;
|
||||
|
||||
if (processFilled && drainContainers(fluidHandler, inv, inputSlot, outputSlot))
|
||||
return;
|
||||
if (processFilled && drainContainers(fluidHandler, inv, inputSlot, outputSlot))
|
||||
return;
|
||||
|
||||
if (processEmpty && fluidToFill != null)
|
||||
fillContainers(fluidHandler, inv, inputSlot, outputSlot, fluidToFill);
|
||||
}
|
||||
if (processEmpty && fluidToFill != null)
|
||||
fillContainers(fluidHandler, inv, inputSlot, outputSlot, fluidToFill);
|
||||
}
|
||||
|
||||
public static boolean fillContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill) {
|
||||
ItemStack input = inv.getStackInSlot(inputSlot);
|
||||
ItemStack output = inv.getStackInSlot(outputSlot);
|
||||
ItemStack filled = getFilledContainer(fluidToFill, input);
|
||||
if (filled != null && (output == null || (output.stackSize < output.getMaxStackSize() && InvTools.isItemEqual(filled, output)))) {
|
||||
FluidStack fluidInContainer = getFluidStackInContainer(filled);
|
||||
FluidStack drain = fluidHandler.drain(ForgeDirection.UNKNOWN, fluidInContainer, false);
|
||||
if (drain != null && drain.amount == fluidInContainer.amount) {
|
||||
fluidHandler.drain(ForgeDirection.UNKNOWN, fluidInContainer, true);
|
||||
if (output == null)
|
||||
inv.setInventorySlotContents(outputSlot, filled);
|
||||
else
|
||||
output.stackSize++;
|
||||
inv.decrStackSize(inputSlot, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean fillContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill) {
|
||||
ItemStack input = inv.getStackInSlot(inputSlot);
|
||||
ItemStack output = inv.getStackInSlot(outputSlot);
|
||||
ItemStack filled = getFilledContainer(fluidToFill, input);
|
||||
if (filled != null && (output == null || (output.stackSize < output.getMaxStackSize() && InvTools.isItemEqual(filled, output)))) {
|
||||
FluidStack fluidInContainer = getFluidStackInContainer(filled);
|
||||
FluidStack drain = fluidHandler.drain(ForgeDirection.UNKNOWN, fluidInContainer, false);
|
||||
if (drain != null && drain.amount == fluidInContainer.amount) {
|
||||
fluidHandler.drain(ForgeDirection.UNKNOWN, fluidInContainer, true);
|
||||
if (output == null)
|
||||
inv.setInventorySlotContents(outputSlot, filled);
|
||||
else
|
||||
output.stackSize++;
|
||||
inv.decrStackSize(inputSlot, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean drainContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot) {
|
||||
ItemStack input = inv.getStackInSlot(inputSlot);
|
||||
ItemStack output = inv.getStackInSlot(outputSlot);
|
||||
public static boolean drainContainers(IFluidHandler fluidHandler, IInventory inv, int slot) {
|
||||
return drainContainers(fluidHandler, inv, slot, slot);
|
||||
}
|
||||
|
||||
if (input != null) {
|
||||
FluidStack fluidInContainer = getFluidStackInContainer(input);
|
||||
ItemStack emptyItem = input.getItem().getContainerItem(input);
|
||||
if (fluidInContainer != null && (emptyItem == null || output == null || (output.stackSize < output.getMaxStackSize() && InvTools.isItemEqual(output, emptyItem)))) {
|
||||
int used = fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, false);
|
||||
if (used >= fluidInContainer.amount) {
|
||||
fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, true);
|
||||
if (emptyItem != null)
|
||||
if (output == null)
|
||||
inv.setInventorySlotContents(outputSlot, emptyItem);
|
||||
else
|
||||
output.stackSize++;
|
||||
inv.decrStackSize(inputSlot, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean drainContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot) {
|
||||
ItemStack input = inv.getStackInSlot(inputSlot);
|
||||
ItemStack output = inv.getStackInSlot(outputSlot);
|
||||
|
||||
public static boolean isBucket(ItemStack stack) {
|
||||
return FluidContainerRegistry.isBucket(stack);
|
||||
}
|
||||
if (input != null) {
|
||||
FluidStack fluidInContainer = getFluidStackInContainer(input);
|
||||
ItemStack emptyItem = input.getItem().getContainerItem(input);
|
||||
if (fluidInContainer != null && (emptyItem == null || output == null
|
||||
|| (inputSlot == outputSlot && input.stackSize == 1)
|
||||
|| (output.stackSize < output.getMaxStackSize() && InvTools.isItemEqual(output, emptyItem)))) {
|
||||
int used = fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, false);
|
||||
if (used >= fluidInContainer.amount) {
|
||||
fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, true);
|
||||
if (emptyItem != null)
|
||||
if (output == null)
|
||||
inv.setInventorySlotContents(outputSlot, emptyItem);
|
||||
else
|
||||
output.stackSize++;
|
||||
inv.decrStackSize(inputSlot, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isContainer(ItemStack stack) {
|
||||
if (stack != null && stack.getItem() instanceof IFluidContainerItem)
|
||||
return true;
|
||||
return FluidContainerRegistry.isContainer(stack);
|
||||
}
|
||||
public static boolean isBucket(ItemStack stack) {
|
||||
return FluidContainerRegistry.isBucket(stack);
|
||||
}
|
||||
|
||||
public static boolean isFilledContainer(ItemStack stack) {
|
||||
return FluidContainerRegistry.isFilledContainer(stack);
|
||||
}
|
||||
public static boolean isContainer(ItemStack stack) {
|
||||
if (stack != null && stack.getItem() instanceof IFluidContainerItem)
|
||||
return true;
|
||||
return FluidContainerRegistry.isContainer(stack);
|
||||
}
|
||||
|
||||
public static boolean isEmptyContainer(ItemStack stack) {
|
||||
return FluidContainerRegistry.isEmptyContainer(stack);
|
||||
}
|
||||
public static boolean isFilledContainer(ItemStack stack) {
|
||||
return FluidContainerRegistry.isFilledContainer(stack);
|
||||
}
|
||||
|
||||
public static ItemStack getFilledContainer(Fluid fluid, ItemStack empty) {
|
||||
if (fluid == null || empty == null) return null;
|
||||
return FluidContainerRegistry.fillFluidContainer(new FluidStack(fluid, Integer.MAX_VALUE), empty);
|
||||
}
|
||||
public static boolean isEmptyContainer(ItemStack stack) {
|
||||
return FluidContainerRegistry.isEmptyContainer(stack);
|
||||
}
|
||||
|
||||
public static ItemStack getFilledContainer(FluidStack fluid, ItemStack empty) {
|
||||
if (fluid == null || empty == null) return null;
|
||||
fluid = fluid.copy();
|
||||
fluid.amount = Integer.MAX_VALUE;
|
||||
return FluidContainerRegistry.fillFluidContainer(fluid, empty);
|
||||
}
|
||||
public static ItemStack getFilledContainer(Fluid fluid, ItemStack empty) {
|
||||
if (fluid == null || empty == null)
|
||||
return null;
|
||||
return FluidContainerRegistry.fillFluidContainer(new FluidStack(fluid, Integer.MAX_VALUE), empty);
|
||||
}
|
||||
|
||||
public static ItemStack fillContainer(FluidStack liquid, ItemStack empty) {
|
||||
if (liquid == null || empty == null) return null;
|
||||
return FluidContainerRegistry.fillFluidContainer(liquid, empty);
|
||||
}
|
||||
public static ItemStack getFilledContainer(FluidStack fluid, ItemStack empty) {
|
||||
if (fluid == null || empty == null)
|
||||
return null;
|
||||
fluid = fluid.copy();
|
||||
fluid.amount = Integer.MAX_VALUE;
|
||||
return FluidContainerRegistry.fillFluidContainer(fluid, empty);
|
||||
}
|
||||
|
||||
public static FluidStack getFluidStackInContainer(ItemStack stack) {
|
||||
return FluidContainerRegistry.getFluidForFilledItem(stack);
|
||||
}
|
||||
public static ItemStack fillContainer(FluidStack liquid, ItemStack empty) {
|
||||
if (liquid == null || empty == null)
|
||||
return null;
|
||||
return FluidContainerRegistry.fillFluidContainer(liquid, empty);
|
||||
}
|
||||
|
||||
public static Fluid getFluidInContianer(ItemStack stack) {
|
||||
FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(stack);
|
||||
return fluidStack != null ? fluidStack.getFluid() : null;
|
||||
}
|
||||
public static FluidStack getFluidStackInContainer(ItemStack stack) {
|
||||
return FluidContainerRegistry.getFluidForFilledItem(stack);
|
||||
}
|
||||
|
||||
public static boolean containsFluidStack(ItemStack stack, FluidStack fluidStack) {
|
||||
return FluidContainerRegistry.containsFluid(stack, fluidStack);
|
||||
}
|
||||
public static Fluid getFluidInContianer(ItemStack stack) {
|
||||
FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(stack);
|
||||
return fluidStack != null ? fluidStack.getFluid() : null;
|
||||
}
|
||||
|
||||
public static boolean containsFluid(ItemStack stack, Fluid fluid) {
|
||||
return FluidContainerRegistry.containsFluid(stack, new FluidStack(fluid, 1));
|
||||
}
|
||||
public static boolean containsFluidStack(ItemStack stack, FluidStack fluidStack) {
|
||||
return FluidContainerRegistry.containsFluid(stack, fluidStack);
|
||||
}
|
||||
|
||||
public static boolean isFluidEqual(FluidStack L1, FluidStack L2) {
|
||||
if (L1 == null || L2 == null)
|
||||
return false;
|
||||
return L1.isFluidEqual(L2);
|
||||
}
|
||||
public static boolean containsFluid(ItemStack stack, Fluid fluid) {
|
||||
return FluidContainerRegistry.containsFluid(stack, new FluidStack(fluid, 1));
|
||||
}
|
||||
|
||||
public static Collection<ItemStack> getContainersFilledWith(FluidStack fluidStack) {
|
||||
List<ItemStack> containers = new ArrayList<ItemStack>();
|
||||
for (FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
|
||||
FluidStack inContainer = getFluidStackInContainer(data.filledContainer);
|
||||
if (inContainer != null && inContainer.containsFluid(fluidStack))
|
||||
containers.add(data.filledContainer.copy());
|
||||
}
|
||||
return containers;
|
||||
}
|
||||
public static boolean isFluidEqual(FluidStack L1, FluidStack L2) {
|
||||
if (L1 == null || L2 == null)
|
||||
return false;
|
||||
return L1.isFluidEqual(L2);
|
||||
}
|
||||
|
||||
public static void nerfWaterBottle() {
|
||||
for (FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
|
||||
if (data.filledContainer.getItem() == Items.potionitem && data.emptyContainer.getItem() == Items.glass_bottle && Fluids.WATER.is(data.fluid)) {
|
||||
data.fluid.amount = 333;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static Collection<ItemStack> getContainersFilledWith(FluidStack fluidStack) {
|
||||
List<ItemStack> containers = new ArrayList<ItemStack>();
|
||||
for (FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
|
||||
FluidStack inContainer = getFluidStackInContainer(data.filledContainer);
|
||||
if (inContainer != null && inContainer.containsFluid(fluidStack))
|
||||
containers.add(data.filledContainer.copy());
|
||||
}
|
||||
return containers;
|
||||
}
|
||||
|
||||
public static FluidStack drainBlock(World world, int x, int y, int z, boolean doDrain) {
|
||||
return drainBlock(world.getBlock(x, y, z), world, x, y, z, doDrain);
|
||||
}
|
||||
public static void nerfWaterBottle() {
|
||||
for (FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData())
|
||||
if (data.filledContainer.getItem() == Items.potionitem && data.emptyContainer.getItem() == Items.glass_bottle && Fluids.WATER.is(data.fluid)) {
|
||||
data.fluid.amount = 333;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static FluidStack drainBlock(Block block, World world, int x, int y, int z, boolean doDrain) {
|
||||
if (block instanceof IFluidBlock) {
|
||||
IFluidBlock fluidBlock = (IFluidBlock)block;
|
||||
if (fluidBlock.canDrain(world, x, y, z))
|
||||
return fluidBlock.drain(world, x, y, z, doDrain);
|
||||
} else if (block == Blocks.water || block == Blocks.flowing_water) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta != 0)
|
||||
return null;
|
||||
if (doDrain)
|
||||
world.setBlockToAir(x, y, z);
|
||||
return new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME);
|
||||
} else if (block == Blocks.lava || block == Blocks.flowing_lava) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta != 0)
|
||||
return null;
|
||||
if (doDrain)
|
||||
world.setBlockToAir(x, y, z);
|
||||
return new FluidStack(FluidRegistry.LAVA, FluidContainerRegistry.BUCKET_VOLUME);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static FluidStack drainBlock(World world, int x, int y, int z, boolean doDrain) {
|
||||
return drainBlock(world.getBlock(x, y, z), world, x, y, z, doDrain);
|
||||
}
|
||||
|
||||
public static boolean isFullFluidBlock(World world, int x, int y, int z) {
|
||||
return isFullFluidBlock(world.getBlock(x, y, z), world, x, y, z);
|
||||
}
|
||||
public static FluidStack drainBlock(Block block, World world, int x, int y, int z, boolean doDrain) {
|
||||
if (block instanceof IFluidBlock) {
|
||||
IFluidBlock fluidBlock = (IFluidBlock) block;
|
||||
if (fluidBlock.canDrain(world, x, y, z))
|
||||
return fluidBlock.drain(world, x, y, z, doDrain);
|
||||
} else if (block == Blocks.water || block == Blocks.flowing_water) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta != 0)
|
||||
return null;
|
||||
if (doDrain)
|
||||
world.setBlockToAir(x, y, z);
|
||||
return new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME);
|
||||
} else if (block == Blocks.lava || block == Blocks.flowing_lava) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta != 0)
|
||||
return null;
|
||||
if (doDrain)
|
||||
world.setBlockToAir(x, y, z);
|
||||
return new FluidStack(FluidRegistry.LAVA, FluidContainerRegistry.BUCKET_VOLUME);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isFullFluidBlock(Block block, World world, int x, int y, int z) {
|
||||
if (block instanceof BlockLiquid || block instanceof IFluidBlock)
|
||||
return world.getBlockMetadata(x, y, z) == 0;
|
||||
return false;
|
||||
}
|
||||
public static boolean isFullFluidBlock(World world, int x, int y, int z) {
|
||||
return isFullFluidBlock(world.getBlock(x, y, z), world, x, y, z);
|
||||
}
|
||||
|
||||
public static Fluid getFluid(Block block) {
|
||||
if (block instanceof IFluidBlock)
|
||||
return ((IFluidBlock) block).getFluid();
|
||||
else if (block == Blocks.water || block == Blocks.flowing_water)
|
||||
return FluidRegistry.WATER;
|
||||
else if (block == Blocks.lava || block == Blocks.flowing_lava)
|
||||
return FluidRegistry.LAVA;
|
||||
return null;
|
||||
}
|
||||
public static boolean isFullFluidBlock(Block block, World world, int x, int y, int z) {
|
||||
if (block instanceof BlockLiquid || block instanceof IFluidBlock)
|
||||
return world.getBlockMetadata(x, y, z) == 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Fluid getFluid(Block block) {
|
||||
if (block instanceof IFluidBlock)
|
||||
return ((IFluidBlock) block).getFluid();
|
||||
else if (block == Blocks.water || block == Blocks.flowing_water)
|
||||
return FluidRegistry.WATER;
|
||||
else if (block == Blocks.lava || block == Blocks.flowing_lava)
|
||||
return FluidRegistry.LAVA;
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.fluids;
|
||||
|
||||
import forestry.core.config.Defaults;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
@@ -23,57 +24,62 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
*/
|
||||
public enum Fluids {
|
||||
|
||||
WATER, LAVA, FUEL, BIOFUEL, CREOSOTE, STEAM, BIOETHANOL, COAL, PYROTHEUM;
|
||||
private final String tag;
|
||||
WATER, LAVA, FUEL, BIOMASS, BIOFUEL, CREOSOTE, STEAM, BIOETHANOL,
|
||||
COAL, PYROTHEUM, HONEY, MILK, JUICE, ICE, GLASS, OIL, SEEDOIL, SHORT_MEAD(Defaults.LIQUID_MEAD);
|
||||
private final String tag;
|
||||
|
||||
private Fluids() {
|
||||
tag = name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
private Fluids() {
|
||||
tag = name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
private Fluids(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public Fluid get() {
|
||||
return FluidRegistry.getFluid(tag);
|
||||
}
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a FluidStack filled with qty milliBuckets worth of Fluid.
|
||||
*
|
||||
* @param qty
|
||||
* @return
|
||||
*/
|
||||
public FluidStack get(int qty) {
|
||||
return FluidRegistry.getFluidStack(tag, qty);
|
||||
}
|
||||
public Fluid get() {
|
||||
return FluidRegistry.getFluid(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a FluidStack filled with n buckets worth of Fluid.
|
||||
*
|
||||
* @param n
|
||||
* @return
|
||||
*/
|
||||
public FluidStack getB(int n) {
|
||||
return FluidRegistry.getFluidStack(tag, n * FluidContainerRegistry.BUCKET_VOLUME);
|
||||
}
|
||||
/**
|
||||
* Gets a FluidStack filled with qty milliBuckets worth of Fluid.
|
||||
*
|
||||
* @param qty
|
||||
* @return
|
||||
*/
|
||||
public FluidStack get(int qty) {
|
||||
return FluidRegistry.getFluidStack(tag, qty);
|
||||
}
|
||||
|
||||
public boolean is(Fluid fluid) {
|
||||
return get() == fluid;
|
||||
}
|
||||
/**
|
||||
* Gets a FluidStack filled with n buckets worth of Fluid.
|
||||
*
|
||||
* @param n
|
||||
* @return
|
||||
*/
|
||||
public FluidStack getB(int n) {
|
||||
return FluidRegistry.getFluidStack(tag, n * FluidContainerRegistry.BUCKET_VOLUME);
|
||||
}
|
||||
|
||||
public boolean is(FluidStack fluidStack) {
|
||||
return fluidStack != null && get() == fluidStack.getFluid();
|
||||
}
|
||||
public boolean is(Fluid fluid) {
|
||||
return get() == fluid;
|
||||
}
|
||||
|
||||
public boolean isContained(ItemStack containerStack) {
|
||||
return containerStack != null && FluidHelper.containsFluid(containerStack, get());
|
||||
}
|
||||
public boolean is(FluidStack fluidStack) {
|
||||
return fluidStack != null && get() == fluidStack.getFluid();
|
||||
}
|
||||
|
||||
public static boolean areEqual(Fluid fluid, FluidStack fluidStack) {
|
||||
if (fluidStack != null && fluid == fluidStack.getFluid())
|
||||
return true;
|
||||
return fluid == null && fluidStack == null;
|
||||
}
|
||||
public boolean isContained(ItemStack containerStack) {
|
||||
return containerStack != null && FluidHelper.containsFluid(containerStack, get());
|
||||
}
|
||||
|
||||
public static boolean areEqual(Fluid fluid, FluidStack fluidStack) {
|
||||
if (fluidStack != null && fluid == fluidStack.getFluid())
|
||||
return true;
|
||||
return fluid == null && fluidStack == null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
* 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
|
||||
******************************************************************************/
|
||||
@@ -14,27 +14,26 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info>
|
||||
*/
|
||||
public final class FakeTank extends StandardTank {
|
||||
|
||||
public static final FakeTank INSTANCE = new FakeTank();
|
||||
public static final FakeTank[] ARRAY = new FakeTank[]{INSTANCE};
|
||||
public static final FluidTankInfo[] INFO = new FluidTankInfo[]{INSTANCE.getInfo()};
|
||||
public static final FakeTank INSTANCE = new FakeTank();
|
||||
public static final FakeTank[] ARRAY = new FakeTank[]{INSTANCE};
|
||||
public static final FluidTankInfo[] INFO = new FluidTankInfo[]{INSTANCE.getInfo()};
|
||||
|
||||
private FakeTank() {
|
||||
super(1);
|
||||
}
|
||||
private FakeTank() {
|
||||
super(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(int maxDrain, boolean doDrain) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public FluidStack drain(int maxDrain, boolean doDrain) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package forestry.core.gadgets;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.core.CreativeTabForestry;
|
||||
import forestry.core.render.TextureManager;
|
||||
|
||||
public class BlockResourceStorageBlock extends Block {
|
||||
|
||||
public BlockResourceStorageBlock() {
|
||||
super(Material.iron);
|
||||
setHardness(3F);
|
||||
setResistance(5F);
|
||||
setCreativeTab(CreativeTabForestry.tabForestry);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconApatite;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconCopper;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTin;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBronze;
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List itemList) {
|
||||
itemList.add(new ItemStack(this, 1, 0));
|
||||
itemList.add(new ItemStack(this, 1, 1));
|
||||
itemList.add(new ItemStack(this, 1, 2));
|
||||
itemList.add(new ItemStack(this, 1, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
iconApatite = TextureManager.getInstance().registerTex(register, "storage/apatite");
|
||||
iconCopper = TextureManager.getInstance().registerTex(register, "storage/copper");
|
||||
iconTin = TextureManager.getInstance().registerTex(register, "storage/tin");
|
||||
iconBronze = TextureManager.getInstance().registerTex(register, "storage/bronze");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int i, int meta) {
|
||||
IIcon icon = null;
|
||||
if (meta == 0) {
|
||||
icon = iconApatite;
|
||||
} else if (meta == 1) {
|
||||
icon = iconCopper;
|
||||
} else if (meta == 2) {
|
||||
icon = iconTin;
|
||||
} else {
|
||||
icon = iconBronze;
|
||||
}
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,8 +72,8 @@ public class BlockStainedGlass extends BlockBreakable {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int meta) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
return block == this ? false : super.shouldSideBeRendered(world, x, y, z, meta);
|
||||
Block block = world.getBlock(x, y, z);
|
||||
return block == this ? false : super.shouldSideBeRendered(world, x, y, z, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,7 @@ package forestry.core.gadgets;
|
||||
|
||||
import forestry.core.network.EntityNetData;
|
||||
|
||||
public abstract class Mill extends TilePowered {
|
||||
public abstract class Mill extends TileBase {
|
||||
|
||||
@EntityNetData
|
||||
public int charge = 0;
|
||||
@@ -23,7 +23,6 @@ public abstract class Mill extends TilePowered {
|
||||
public float progress;
|
||||
|
||||
public Mill() {
|
||||
super(0, 0, 0);
|
||||
speed = 0.01F;
|
||||
}
|
||||
|
||||
@@ -76,10 +75,4 @@ public abstract class Mill extends TilePowered {
|
||||
}
|
||||
|
||||
protected abstract void activate();
|
||||
|
||||
@Override
|
||||
public boolean isWorking() {
|
||||
return charge != 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,18 +23,18 @@ import net.minecraft.network.Packet;
|
||||
|
||||
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.core.ForestryAPI;
|
||||
import forestry.api.core.ISpecialInventory;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
@@ -42,14 +42,17 @@ import forestry.core.network.PacketIds;
|
||||
import forestry.core.network.PacketInventoryStack;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.inventory.InvTools;
|
||||
import forestry.core.inventory.wrappers.IInvSlot;
|
||||
import forestry.core.inventory.wrappers.InventoryIterator;
|
||||
import forestry.core.inventory.wrappers.InventoryMapper;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class TileAnalyzer extends TileBase implements ISpecialInventory, ISidedInventory, ILiquidTankContainer {
|
||||
public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiquidTankContainer {
|
||||
|
||||
/* CONSTANTS */
|
||||
public static final int TIME_TO_ANALYZE = 500;
|
||||
public static final int TIME_TO_ANALYZE = 125;
|
||||
public static final int HONEY_REQUIRED = 100;
|
||||
|
||||
public static final short SLOT_ANALYZE = 0;
|
||||
@@ -62,11 +65,6 @@ public class TileAnalyzer extends TileBase implements ISpecialInventory, ISidedI
|
||||
|
||||
private int analyzeTime;
|
||||
|
||||
private final short analyzeSlot = 0;
|
||||
private final short canSlot = 1;
|
||||
private final short inputSlot1 = 2;
|
||||
private final short outputSlot1 = 8;
|
||||
|
||||
@EntityNetData
|
||||
public FilteredTank resourceTank;
|
||||
|
||||
@@ -74,9 +72,12 @@ public class TileAnalyzer extends TileBase implements ISpecialInventory, ISidedI
|
||||
|
||||
private final Stack<ItemStack> pendingProducts = new Stack<ItemStack>();
|
||||
|
||||
private final IInventory invInput = new InventoryMapper(inventory, SLOT_INPUT_1, 6);
|
||||
|
||||
/* CONSTRUCTOR */
|
||||
public TileAnalyzer() {
|
||||
resourceTank = new FilteredTank(Defaults.PROCESSOR_TANK_CAPACITY, FluidRegistry.getFluid(Defaults.LIQUID_HONEY));
|
||||
super(800, 40, Defaults.MACHINE_MAX_ENERGY);
|
||||
resourceTank = new FilteredTank(Defaults.PROCESSOR_TANK_CAPACITY, Fluids.HONEY.get());
|
||||
tankManager = new TankManager(resourceTank);
|
||||
}
|
||||
|
||||
@@ -135,92 +136,116 @@ public class TileAnalyzer extends TileBase implements ISpecialInventory, ISidedI
|
||||
inventory.readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
/* WORKING */
|
||||
@Override
|
||||
public void updateServerSide() {
|
||||
// If we add pending products, we skip to the next work cycle.
|
||||
if (tryAddPending())
|
||||
return;
|
||||
protected void updateServerSide() {
|
||||
// Check if we have suitable items waiting in the can slot
|
||||
FluidHelper.drainContainers(tankManager, this, SLOT_CAN);
|
||||
ItemStack can = getStackInSlot(SLOT_CAN);
|
||||
if (ForestryItem.honeyDrop.isItemEqual(can) && resourceTank.fill(Fluids.HONEY.get(Defaults.FLUID_PER_HONEY_DROP), false) == Defaults.FLUID_PER_HONEY_DROP) {
|
||||
setInventorySlotContents(SLOT_CAN, InvTools.depleteItem(can));
|
||||
resourceTank.fill(Fluids.HONEY.get(Defaults.FLUID_PER_HONEY_DROP), true);
|
||||
}
|
||||
|
||||
for (int i = 0; i < invInput.getSizeInventory(); i++) {
|
||||
ItemStack inputStack = invInput.getStackInSlot(i);
|
||||
if (inputStack == null || !AlleleManager.alleleRegistry.isIndividual(inputStack))
|
||||
continue;
|
||||
// Analyzed bees in the input buffer are added to the output queue.
|
||||
IIndividual individual = AlleleManager.alleleRegistry.getIndividual(inputStack);
|
||||
if (individual.isAnalyzed()) {
|
||||
pendingProducts.push(inputStack);
|
||||
invInput.decrStackSize(i, inputStack.stackSize);
|
||||
}
|
||||
}
|
||||
|
||||
tryAddPending();
|
||||
if (!pendingProducts.isEmpty()) {
|
||||
setErrorState(EnumErrorCode.NOSPACE);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if we have suitable items waiting in the can slot
|
||||
if (getStackInSlot(canSlot) != null) {
|
||||
FluidContainerData container = LiquidHelper.getLiquidContainer(getStackInSlot(canSlot));
|
||||
if (container != null && resourceTank.accepts(container.fluid.getFluid())) {
|
||||
|
||||
setInventorySlotContents(canSlot, StackUtils.replenishByContainer(this, getStackInSlot(canSlot), container, resourceTank));
|
||||
if (getStackInSlot(canSlot).stackSize <= 0)
|
||||
setInventorySlotContents(canSlot, null);
|
||||
if (analyzeTime == 0) {
|
||||
// Look for bees in input slots.
|
||||
IInvSlot slot = getInputSlot();
|
||||
if (slot == null) {
|
||||
// Nothing to analyze
|
||||
setErrorState(EnumErrorCode.NOTHINGANALYZE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (analyzeTime > 0 && getStackInSlot(analyzeSlot) != null && AlleleManager.alleleRegistry.isIndividual(getStackInSlot(analyzeSlot))) {
|
||||
// We need our liquid honey
|
||||
if (resourceTank.getFluidAmount() < HONEY_REQUIRED) {
|
||||
setErrorState(EnumErrorCode.NORESOURCE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (energyManager.getTotalEnergyStored() == 0) {
|
||||
setErrorState(EnumErrorCode.NOPOWER);
|
||||
return;
|
||||
}
|
||||
|
||||
setErrorState(EnumErrorCode.OK);
|
||||
}
|
||||
|
||||
/* WORKING */
|
||||
@Override
|
||||
public boolean workCycle() {
|
||||
ItemStack stackToAnalyze = getStackInSlot(SLOT_ANALYZE);
|
||||
if (analyzeTime > 0 && stackToAnalyze != null && AlleleManager.alleleRegistry.isIndividual(stackToAnalyze)) {
|
||||
|
||||
analyzeTime--;
|
||||
|
||||
// Still not done
|
||||
if (analyzeTime > 0) {
|
||||
setErrorState(EnumErrorCode.OK);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Analyzation is done.
|
||||
IIndividual individual = AlleleManager.alleleRegistry.getIndividual(getStackInSlot(analyzeSlot));
|
||||
IIndividual individual = AlleleManager.alleleRegistry.getIndividual(stackToAnalyze);
|
||||
// No bee, abort
|
||||
if (individual == null)
|
||||
return;
|
||||
return false;
|
||||
|
||||
individual.analyze();
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
individual.writeToNBT(nbttagcompound);
|
||||
getStackInSlot(analyzeSlot).setTagCompound(nbttagcompound);
|
||||
stackToAnalyze.setTagCompound(nbttagcompound);
|
||||
|
||||
pendingProducts.push(getStackInSlot(analyzeSlot));
|
||||
setInventorySlotContents(analyzeSlot, null);
|
||||
pendingProducts.push(stackToAnalyze);
|
||||
setInventorySlotContents(SLOT_ANALYZE, null);
|
||||
sendNetworkUpdate();
|
||||
|
||||
} else {
|
||||
analyzeTime = 0;
|
||||
|
||||
// Don't start if analyze slot already occupied
|
||||
if (getStackInSlot(analyzeSlot) != null)
|
||||
return;
|
||||
|
||||
// We need our liquid honey
|
||||
if (resourceTank.getFluidAmount() < HONEY_REQUIRED) {
|
||||
setErrorState(EnumErrorCode.NORESOURCE);
|
||||
return;
|
||||
}
|
||||
|
||||
// Look for bees in input slots.
|
||||
for (int i = inputSlot1; i < outputSlot1; i++) {
|
||||
if (getStackInSlot(i) == null || !AlleleManager.alleleRegistry.isIndividual(getStackInSlot(i)))
|
||||
continue;
|
||||
|
||||
// Analyzed bees in the input buffer are added to the output
|
||||
// queue at once.
|
||||
IIndividual individual = AlleleManager.alleleRegistry.getIndividual(getStackInSlot(i));
|
||||
if (individual.isAnalyzed()) {
|
||||
pendingProducts.push(getStackInSlot(i));
|
||||
setInventorySlotContents(i, null);
|
||||
continue;
|
||||
}
|
||||
|
||||
setInventorySlotContents(analyzeSlot, getStackInSlot(i));
|
||||
setInventorySlotContents(i, null);
|
||||
resourceTank.drain(HONEY_REQUIRED, true);
|
||||
analyzeTime = TIME_TO_ANALYZE;
|
||||
sendNetworkUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
// Nothing to analyze
|
||||
setErrorState(EnumErrorCode.NOTHINGANALYZE);
|
||||
return true;
|
||||
}
|
||||
|
||||
analyzeTime = 0;
|
||||
|
||||
// Don't start if analyze slot already occupied
|
||||
if (stackToAnalyze != null)
|
||||
return false;
|
||||
|
||||
if (getErrorState() != EnumErrorCode.OK)
|
||||
return false;
|
||||
|
||||
// Look for bees in input slots.
|
||||
IInvSlot slot = getInputSlot();
|
||||
ItemStack inputStack = slot.getStackInSlot();
|
||||
setInventorySlotContents(SLOT_ANALYZE, inputStack);
|
||||
slot.setStackInSlot(null);
|
||||
resourceTank.drain(HONEY_REQUIRED, true);
|
||||
analyzeTime = TIME_TO_ANALYZE;
|
||||
sendNetworkUpdate();
|
||||
return true;
|
||||
}
|
||||
|
||||
private IInvSlot getInputSlot() {
|
||||
for (IInvSlot slot : InventoryIterator.getIterable(invInput)) {
|
||||
ItemStack inputStack = slot.getStackInSlot();
|
||||
if (inputStack != null && AlleleManager.alleleRegistry.isIndividual(inputStack))
|
||||
return slot;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean tryAddPending() {
|
||||
@@ -228,7 +253,7 @@ public class TileAnalyzer extends TileBase implements ISpecialInventory, ISidedI
|
||||
return false;
|
||||
|
||||
ItemStack next = pendingProducts.peek();
|
||||
if (inventory.tryAddStack(next, outputSlot1, inventory.getSizeInventory() - outputSlot1, true)) {
|
||||
if (inventory.tryAddStack(next, SLOT_OUTPUT_1, inventory.getSizeInventory() - SLOT_OUTPUT_1, true)) {
|
||||
pendingProducts.pop();
|
||||
return true;
|
||||
}
|
||||
@@ -237,10 +262,21 @@ public class TileAnalyzer extends TileBase implements ISpecialInventory, ISidedI
|
||||
|
||||
/* STATE INFORMATION */
|
||||
// @Override
|
||||
@Override
|
||||
public boolean isWorking() {
|
||||
return analyzeTime > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasWork() {
|
||||
if (!pendingProducts.isEmpty())
|
||||
return true;
|
||||
if (analyzeTime > 0)
|
||||
return true;
|
||||
|
||||
return getErrorState() == EnumErrorCode.OK ||getErrorState() == EnumErrorCode.NOPOWER;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int i) {
|
||||
return (analyzeTime * i) / TIME_TO_ANALYZE;
|
||||
}
|
||||
@@ -250,10 +286,11 @@ public class TileAnalyzer extends TileBase implements ISpecialInventory, ISidedI
|
||||
}
|
||||
|
||||
public ItemStack getIndividualOnDisplay() {
|
||||
return getStackInSlot(analyzeSlot);
|
||||
return getStackInSlot(SLOT_ANALYZE);
|
||||
}
|
||||
|
||||
/* SMP */
|
||||
@Override
|
||||
public void getGUINetworkData(int i, int j) {
|
||||
i -= tankManager.maxMessageId() + 1;
|
||||
switch (i) {
|
||||
@@ -263,23 +300,13 @@ public class TileAnalyzer extends TileBase implements ISpecialInventory, ISidedI
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
|
||||
int i = tankManager.maxMessageId() + 1;
|
||||
iCrafting.sendProgressBarUpdate(container, i, analyzeTime);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendNetworkUpdate() {
|
||||
Proxies.net.sendNetworkPacket(new PacketInventoryStack(PacketIds.IINVENTORY_STACK, xCoord, yCoord, zCoord, SLOT_ANALYZE, inventory.getStackInSlot(SLOT_ANALYZE)),
|
||||
xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
return new PacketInventoryStack(PacketIds.IINVENTORY_STACK, xCoord, yCoord, zCoord, SLOT_ANALYZE, inventory.getStackInSlot(SLOT_ANALYZE)).getPacket();
|
||||
}
|
||||
|
||||
/* ISIDEDINVENTORY */
|
||||
@Override
|
||||
public InventoryAdapter getInternalInventory() {
|
||||
@@ -288,37 +315,64 @@ public class TileAnalyzer extends TileBase implements ISpecialInventory, ISidedI
|
||||
|
||||
@Override
|
||||
protected boolean canTakeStackFromSide(int slotIndex, ItemStack itemstack, int side) {
|
||||
if(!super.canTakeStackFromSide(slotIndex, itemstack, side))
|
||||
if (!super.canTakeStackFromSide(slotIndex, itemstack, side))
|
||||
return false;
|
||||
|
||||
return slotIndex >= SLOT_OUTPUT_1 && slotIndex < SLOT_OUTPUT_1 + 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canPutStackFromSide(int slotIndex, ItemStack itemstack, int side) {
|
||||
protected boolean canPutStackFromSide(int slotIndex, ItemStack stack, int side) {
|
||||
|
||||
if(!super.canPutStackFromSide(slotIndex, itemstack, side))
|
||||
if (!super.canPutStackFromSide(slotIndex, stack, side))
|
||||
return false;
|
||||
|
||||
if(slotIndex >= SLOT_INPUT_1 && slotIndex < SLOT_INPUT_1 + 6)
|
||||
return AlleleManager.alleleRegistry.isIndividual(itemstack);
|
||||
if (slotIndex >= SLOT_INPUT_1 && slotIndex < SLOT_INPUT_1 + 6)
|
||||
return AlleleManager.alleleRegistry.isIndividual(stack);
|
||||
|
||||
if(slotIndex == SLOT_CAN) {
|
||||
FluidContainerData container = LiquidHelper.getLiquidContainer(itemstack);
|
||||
return container != null && LiquidHelper.isLiquid(Defaults.LIQUID_HONEY, container.fluid);
|
||||
}
|
||||
if (slotIndex == SLOT_CAN)
|
||||
return Fluids.HONEY.isContained(stack);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public int getSizeInventory() { return inventory.getSizeInventory(); }
|
||||
@Override public ItemStack getStackInSlot(int i) { return inventory.getStackInSlot(i); }
|
||||
@Override public ItemStack decrStackSize(int i, int j) { return inventory.decrStackSize(i, j); }
|
||||
@Override public void setInventorySlotContents(int i, ItemStack itemstack) { inventory.setInventorySlotContents(i, itemstack); }
|
||||
@Override public int getInventoryStackLimit() { return inventory.getInventoryStackLimit(); }
|
||||
@Override public ItemStack getStackInSlotOnClosing(int slot) { return inventory.getStackInSlotOnClosing(slot); }
|
||||
@Override public void openInventory() {}
|
||||
@Override public void closeInventory() {}
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventory.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return inventory.getStackInSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
return inventory.decrStackSize(i, j);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventory.setInventorySlotContents(i, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return inventory.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return inventory.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: just a specialsource workaround
|
||||
@@ -368,66 +422,6 @@ public class TileAnalyzer extends TileBase implements ISpecialInventory, ISidedI
|
||||
return super.getAccessibleSlotsFromSide(side);
|
||||
}
|
||||
|
||||
/* ISPECIALINVENTORY */
|
||||
@Override
|
||||
public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {
|
||||
|
||||
ItemStack product = null;
|
||||
|
||||
for (int i = outputSlot1; i < inventory.getSizeInventory(); i++) {
|
||||
if (inventory.getStackInSlot(i) == null)
|
||||
continue;
|
||||
|
||||
product = getStackInSlot(i).copy();
|
||||
if (doRemove) {
|
||||
getStackInSlot(i).stackSize = 0;
|
||||
setInventorySlotContents(i, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return new ItemStack[] { product };
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
|
||||
|
||||
if (!AlleleManager.alleleRegistry.isIndividual(stack)) {
|
||||
|
||||
FluidContainerData container = LiquidHelper.getLiquidContainer(stack);
|
||||
if (container == null || !resourceTank.accepts(container.fluid.getFluid()))
|
||||
return 0;
|
||||
|
||||
if (getStackInSlot(canSlot) == null) {
|
||||
if (doAdd)
|
||||
setInventorySlotContents(canSlot, stack.copy());
|
||||
|
||||
return stack.stackSize;
|
||||
}
|
||||
|
||||
int space = getStackInSlot(canSlot).getMaxStackSize() - getStackInSlot(canSlot).stackSize;
|
||||
if (space <= 0)
|
||||
return 0;
|
||||
|
||||
if (doAdd) {
|
||||
getStackInSlot(canSlot).stackSize += stack.stackSize;
|
||||
if (getStackInSlot(canSlot).stackSize > getStackInSlot(canSlot).getMaxStackSize())
|
||||
getStackInSlot(canSlot).stackSize = getStackInSlot(canSlot).getMaxStackSize();
|
||||
}
|
||||
|
||||
return space;
|
||||
}
|
||||
|
||||
for (int i = inputSlot1; i < outputSlot1; i++)
|
||||
if (getStackInSlot(i) == null) {
|
||||
if (doAdd)
|
||||
setInventorySlotContents(i, stack.copy());
|
||||
|
||||
return stack.stackSize;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ILIQUIDCONTAINER */
|
||||
@Override
|
||||
public TankManager getTankManager() {
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.core.EnumErrorCode;
|
||||
@@ -147,7 +147,7 @@ public abstract class TileForestry extends TileEntity implements INetworkedEntit
|
||||
fromPacketPayload(packet.payload);
|
||||
}
|
||||
|
||||
public LinkedList<ITrigger> getCustomTriggers() {
|
||||
public LinkedList<ITriggerExternal> getCustomTriggers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,20 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.gadgets;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ISpecialInventory;
|
||||
@@ -37,11 +23,19 @@ import forestry.core.utils.EnumAccess;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import forestry.plugins.PluginCore;
|
||||
import forestry.plugins.PluginEnergy;
|
||||
import forestry.plugins.PluginFactory;
|
||||
import forestry.plugins.PluginMail;
|
||||
import forestry.plugins.PluginIC2;
|
||||
import forestry.plugins.PluginMail;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public abstract class TileMachine extends TileForestry implements ISpecialInventory, IClimatised, IHintSource {
|
||||
|
||||
@@ -163,7 +157,7 @@ public abstract class TileMachine extends TileForestry implements ISpecialInvent
|
||||
millMap.put(Defaults.ID_PACKAGE_MILL_TRADER, PluginMail.definitionTradestation);
|
||||
millMap.put(Defaults.ID_PACKAGE_MILL_PHILATELIST, PluginMail.definitionPhilatelist);
|
||||
millMap.put(Defaults.ID_PACKAGE_MILL_APIARIST_CHEST, PluginApiculture.definitionChest);
|
||||
millMap.put(Defaults.ID_PACKAGE_MILL_ANALYZER, PluginCore.definitionAnalyzer);
|
||||
millMap.put(Defaults.ID_PACKAGE_MILL_ANALYZER, PluginApiculture.definitionAnalyzer);
|
||||
millMap.put(Defaults.ID_PACKAGE_MILL_RAINMAKER, PluginFactory.definitionRainmaker);
|
||||
definitionMap.put(ForestryBlock.factoryPlain.block(), millMap);
|
||||
|
||||
@@ -379,11 +373,4 @@ public abstract class TileMachine extends TileForestry implements ISpecialInvent
|
||||
// NEIGHBOUR CHANGE
|
||||
public void onNeighborBlockChange() {
|
||||
}
|
||||
|
||||
// ITRIGGERPROVIDER
|
||||
@Override
|
||||
public LinkedList<ITrigger> getCustomTriggers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,11 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.gadgets;
|
||||
|
||||
import buildcraft.api.tiles.IHasWork;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.interfaces.IPowerHandler;
|
||||
import forestry.core.interfaces.IRenderableMachine;
|
||||
import forestry.core.network.ClassMap;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.IndexInPayload;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.proxy.Proxies;
|
||||
@@ -25,7 +26,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
|
||||
public abstract class TilePowered extends TileBase implements IRenderableMachine, IPowerHandler {
|
||||
@Optional.Interface(iface = "buildcraft.api.tiles.IHasWork", modid = "BuildCraft|Core")
|
||||
public abstract class TilePowered extends TileBase implements IRenderableMachine, IPowerHandler, IHasWork {
|
||||
|
||||
public static int WORK_CYCLES = 4;
|
||||
|
||||
@@ -82,9 +84,7 @@ public abstract class TilePowered extends TileBase implements IRenderableMachine
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasWork() {
|
||||
return false;
|
||||
}
|
||||
public abstract boolean hasWork();
|
||||
|
||||
private int workCounter;
|
||||
|
||||
@@ -119,6 +119,10 @@ public abstract class TilePowered extends TileBase implements IRenderableMachine
|
||||
}
|
||||
|
||||
/* LIQUID CONTAINER HANDLING */
|
||||
/**
|
||||
@deprecated Use FluidHelper
|
||||
*/
|
||||
@Deprecated
|
||||
protected ItemStack bottleIntoContainer(ItemStack canStack, ItemStack outputStack, FluidContainerData container, StandardTank tank) {
|
||||
if (tank.getFluidAmount() < container.fluid.amount)
|
||||
return outputStack;
|
||||
|
||||
@@ -408,6 +408,10 @@ public class Allele implements IAllele {
|
||||
public static Allele plantTypeNether;
|
||||
public static Allele plantTypeCrop;
|
||||
|
||||
// / TREES // FIREPROOF
|
||||
public static Allele fireproofFalse;
|
||||
public static Allele fireproofTrue;
|
||||
|
||||
public static void initialize() {
|
||||
// ALL // GENERIC
|
||||
boolFalse = new AlleleBoolean("boolFalse", false);
|
||||
@@ -425,13 +429,13 @@ public class Allele implements IAllele {
|
||||
int10 = new AlleleInteger("i10d", 10, true);
|
||||
|
||||
// BEES // SPEED
|
||||
speedSlowest = new AlleleFloat("speedSlowest", 0.3f, true).setName("gui.slowest");
|
||||
speedSlower = new AlleleFloat("speedSlower", 0.6f, true).setName("gui.slower");
|
||||
speedSlow = new AlleleFloat("speedSlow", 0.8f, true).setName("gui.slow");
|
||||
speedNorm = new AlleleFloat("speedNorm", 1.0f).setName("gui.normal");
|
||||
speedFast = new AlleleFloat("speedFast", 1.2f, true).setName("gui.fast");
|
||||
speedFaster = new AlleleFloat("speedFaster", 1.4f).setName("gui.faster");
|
||||
speedFastest = new AlleleFloat("speedFastest", 1.7f).setName("gui.fastest");
|
||||
speedSlowest = new AlleleFloat("speedSlowest", 0.3f, true).setName("speed", "slowest");
|
||||
speedSlower = new AlleleFloat("speedSlower", 0.6f, true).setName("speed", "slower");
|
||||
speedSlow = new AlleleFloat("speedSlow", 0.8f, true).setName("speed", "slow");
|
||||
speedNorm = new AlleleFloat("speedNorm", 1.0f).setName("speed", "normal");
|
||||
speedFast = new AlleleFloat("speedFast", 1.2f, true).setName("speed", "fast");
|
||||
speedFaster = new AlleleFloat("speedFaster", 1.4f).setName("speed", "faster");
|
||||
speedFastest = new AlleleFloat("speedFastest", 1.7f).setName("speed", "fastest");
|
||||
|
||||
// BEES // LIFESPAN
|
||||
lifespanShortest = new AlleleInteger("lifespanShortest", 10, false).setName("gui.shortestlife");
|
||||
@@ -451,23 +455,23 @@ public class Allele implements IAllele {
|
||||
fertilityMaximum = new AlleleInteger("fertilityMaximum", 4);
|
||||
|
||||
// TREES // HEIGHT
|
||||
heightSmallest = new AlleleFloat("heightSmallest", 0.25f).setName("gui.smallest");
|
||||
heightSmaller = new AlleleFloat("heightSmaller", 0.5f).setName("gui.smaller");
|
||||
heightSmall = new AlleleFloat("heightSmall", 0.75f).setName("gui.small");
|
||||
heightAverage = new AlleleFloat("heightMax10", 1.0f).setName("gui.average");
|
||||
heightLarge = new AlleleFloat("heightLarge", 1.25f).setName("gui.large");
|
||||
heightLarger = new AlleleFloat("heightLarger", 1.5f).setName("gui.larger");
|
||||
heightLargest = new AlleleFloat("heightLargest", 1.75f).setName("gui.largest");
|
||||
heightGigantic = new AlleleFloat("heightGigantic", 2.0f).setName("gui.gigantic");
|
||||
heightSmallest = new AlleleFloat("heightSmallest", 0.25f).setName("height", "smallest");
|
||||
heightSmaller = new AlleleFloat("heightSmaller", 0.5f).setName("height", "smaller");
|
||||
heightSmall = new AlleleFloat("heightSmall", 0.75f).setName("height", "small");
|
||||
heightAverage = new AlleleFloat("heightMax10", 1.0f).setName("height", "average");
|
||||
heightLarge = new AlleleFloat("heightLarge", 1.25f).setName("height", "large");
|
||||
heightLarger = new AlleleFloat("heightLarger", 1.5f).setName("height", "larger");
|
||||
heightLargest = new AlleleFloat("heightLargest", 1.75f).setName("height", "largest");
|
||||
heightGigantic = new AlleleFloat("heightGigantic", 2.0f).setName("height", "gigantic");
|
||||
|
||||
// BUTTERFLIES // SIZE
|
||||
sizeSmallest = new AlleleFloat("sizeSmallest", 0.3f).setName("gui.smallest");
|
||||
sizeSmaller = new AlleleFloat("sizeSmaller", 0.4f).setName("gui.smaller");
|
||||
sizeSmall = new AlleleFloat("sizeSmall", 0.5f).setName("gui.small");
|
||||
sizeAverage = new AlleleFloat("sizeAverage", 0.6f).setName("gui.average");
|
||||
sizeLarge = new AlleleFloat("sizeLarge", 0.75f).setName("gui.large");
|
||||
sizeLarger = new AlleleFloat("sizeLarger", 0.9f).setName("gui.larger");
|
||||
sizeLargest = new AlleleFloat("sizeLargest", 1.0f).setName("gui.largest");
|
||||
sizeSmallest = new AlleleFloat("sizeSmallest", 0.3f).setName("size", "smallest");
|
||||
sizeSmaller = new AlleleFloat("sizeSmaller", 0.4f).setName("size", "smaller");
|
||||
sizeSmall = new AlleleFloat("sizeSmall", 0.5f).setName("size", "small");
|
||||
sizeAverage = new AlleleFloat("sizeAverage", 0.6f).setName("size", "average");
|
||||
sizeLarge = new AlleleFloat("sizeLarge", 0.75f).setName("size", "large");
|
||||
sizeLarger = new AlleleFloat("sizeLarger", 0.9f).setName("size", "larger");
|
||||
sizeLargest = new AlleleFloat("sizeLargest", 1.0f).setName("size", "largest");
|
||||
|
||||
// BEES // TOLERANCE
|
||||
toleranceNone = new AlleleTolerance("toleranceNone", EnumTolerance.NONE);
|
||||
@@ -488,61 +492,61 @@ public class Allele implements IAllele {
|
||||
toleranceDown5 = new AlleleTolerance("toleranceDown5", EnumTolerance.DOWN_5);
|
||||
|
||||
// TREES // FERTILITY
|
||||
saplingsLowest = new AlleleFloat("saplingsLowest", 0.01f, true).setName("gui.lowest");
|
||||
saplingsLower = new AlleleFloat("saplingsLower", 0.025f, true).setName("gui.lower");
|
||||
saplingsLow = new AlleleFloat("saplingsLow", 0.035f, true).setName("gui.low");
|
||||
saplingsAverage = new AlleleFloat("saplingsDefault", 0.05f, true).setName("gui.average");
|
||||
saplingsHigh = new AlleleFloat("saplingsDouble", 0.1f, true).setName("gui.high");
|
||||
saplingsHigher = new AlleleFloat("saplingsTriple", 0.2f, true).setName("gui.higher");
|
||||
saplingsHighest = new AlleleFloat("saplingsHighest", 0.3f, true).setName("gui.highest");
|
||||
saplingsLowest = new AlleleFloat("saplingsLowest", 0.01f, true).setName("saplings", "lowest");
|
||||
saplingsLower = new AlleleFloat("saplingsLower", 0.025f, true).setName("saplings", "lower");
|
||||
saplingsLow = new AlleleFloat("saplingsLow", 0.035f, true).setName("saplings", "low");
|
||||
saplingsAverage = new AlleleFloat("saplingsDefault", 0.05f, true).setName("saplings", "average");
|
||||
saplingsHigh = new AlleleFloat("saplingsDouble", 0.1f, true).setName("saplings", "high");
|
||||
saplingsHigher = new AlleleFloat("saplingsTriple", 0.2f, true).setName("saplings", "higher");
|
||||
saplingsHighest = new AlleleFloat("saplingsHighest", 0.3f, true).setName("saplings", "highest");
|
||||
|
||||
// TREES // YIELD
|
||||
yieldLowest = new AlleleFloat("yieldLowest", 0.025f, true).setName("gui.lowest");
|
||||
yieldLower = new AlleleFloat("yieldLower", 0.05f, true).setName("gui.lower");
|
||||
yieldLow = new AlleleFloat("yieldLow", 0.1f, true).setName("gui.low");
|
||||
yieldAverage = new AlleleFloat("yieldDefault", 0.2f, true).setName("gui.average");
|
||||
yieldHigh = new AlleleFloat("yieldHigh", 0.3f, false).setName("gui.high");
|
||||
yieldHigher = new AlleleFloat("yieldHigher", 0.35f, false).setName("gui.higher");
|
||||
yieldHighest = new AlleleFloat("yieldHighest", 0.4f, false).setName("gui.highest");
|
||||
yieldLowest = new AlleleFloat("yieldLowest", 0.025f, true).setName("yield", "lowest");
|
||||
yieldLower = new AlleleFloat("yieldLower", 0.05f, true).setName("yield", "lower");
|
||||
yieldLow = new AlleleFloat("yieldLow", 0.1f, true).setName("yield", "low");
|
||||
yieldAverage = new AlleleFloat("yieldDefault", 0.2f, true).setName("yield", "average");
|
||||
yieldHigh = new AlleleFloat("yieldHigh", 0.3f, false).setName("yield", "high");
|
||||
yieldHigher = new AlleleFloat("yieldHigher", 0.35f, false).setName("yield", "higher");
|
||||
yieldHighest = new AlleleFloat("yieldHighest", 0.4f, false).setName("yield", "highest");
|
||||
|
||||
// TREES // SAPPINESS
|
||||
sappinessLowest = new AlleleFloat("sappinessLowest", 0.1f, true).setName("gui.lowest");
|
||||
sappinessLower = new AlleleFloat("sappinessLower", 0.2f, true).setName("gui.lower");
|
||||
sappinessLow = new AlleleFloat("sappinessLow", 0.3f, true).setName("gui.low");
|
||||
sappinessAverage = new AlleleFloat("sappinessAverage", 0.4f, true).setName("gui.average");
|
||||
sappinessHigh = new AlleleFloat("sappinessHigh", 0.6f, true).setName("gui.high");
|
||||
sappinessHigher = new AlleleFloat("sappinessHigher", 0.8f, false).setName("gui.higher");
|
||||
sappinessHighest = new AlleleFloat("sappinessHighest", 1.0f, false).setName("gui.highest");
|
||||
sappinessLowest = new AlleleFloat("sappinessLowest", 0.1f, true).setName("sappiness", "lowest");
|
||||
sappinessLower = new AlleleFloat("sappinessLower", 0.2f, true).setName("sappiness", "lower");
|
||||
sappinessLow = new AlleleFloat("sappinessLow", 0.3f, true).setName("sappiness", "low");
|
||||
sappinessAverage = new AlleleFloat("sappinessAverage", 0.4f, true).setName("sappiness", "average");
|
||||
sappinessHigh = new AlleleFloat("sappinessHigh", 0.6f, true).setName("sappiness", "high");
|
||||
sappinessHigher = new AlleleFloat("sappinessHigher", 0.8f, false).setName("sappiness", "higher");
|
||||
sappinessHighest = new AlleleFloat("sappinessHighest", 1.0f, false).setName("sappiness", "highest");
|
||||
|
||||
// TREES // MATURATION TIME
|
||||
maturationSlowest = new AlleleInteger("maturationSlowest", 10, true).setName("gui.slowest");
|
||||
maturationSlower = new AlleleInteger("maturationSlower", 7).setName("gui.slower");
|
||||
maturationSlow = new AlleleInteger("maturationSlow", 5, true).setName("gui.slow");
|
||||
maturationAverage = new AlleleInteger("maturationAverage", 4).setName("gui.average");
|
||||
maturationFast = new AlleleInteger("maturationFast", 3).setName("gui.fast");
|
||||
maturationFaster = new AlleleInteger("maturationFaster", 2).setName("gui.faster");
|
||||
maturationFastest = new AlleleInteger("maturationFastest", 1).setName("gui.fastest");
|
||||
maturationSlowest = new AlleleInteger("maturationSlowest", 10, true).setName("maturity", "slowest");
|
||||
maturationSlower = new AlleleInteger("maturationSlower", 7).setName("maturity", "slower");
|
||||
maturationSlow = new AlleleInteger("maturationSlow", 5, true).setName("maturity", "slow");
|
||||
maturationAverage = new AlleleInteger("maturationAverage", 4).setName("maturity", "average");
|
||||
maturationFast = new AlleleInteger("maturationFast", 3).setName("maturity", "fast");
|
||||
maturationFaster = new AlleleInteger("maturationFaster", 2).setName("maturity", "faster");
|
||||
maturationFastest = new AlleleInteger("maturationFastest", 1).setName("maturity", "fastest");
|
||||
|
||||
// BEES // FLOWER GROWTH
|
||||
floweringSlowest = new AlleleInteger("floweringSlowest", 5, true).setName("gui.slowest");
|
||||
floweringSlower = new AlleleInteger("floweringSlower", 10).setName("gui.slower");
|
||||
floweringSlow = new AlleleInteger("floweringSlow", 15).setName("gui.slow");
|
||||
floweringAverage = new AlleleInteger("floweringAverage", 20).setName("gui.average");
|
||||
floweringFast = new AlleleInteger("floweringFast", 25).setName("gui.fast");
|
||||
floweringFaster = new AlleleInteger("floweringFaster", 30).setName("gui.faster");
|
||||
floweringFastest = new AlleleInteger("floweringFastest", 35).setName("gui.fastest");
|
||||
floweringMaximum = new AlleleInteger("floweringMaximum", 99, true).setName("gui.maximum");
|
||||
floweringSlowest = new AlleleInteger("floweringSlowest", 5, true).setName("flowering", "slowest");
|
||||
floweringSlower = new AlleleInteger("floweringSlower", 10).setName("flowering", "slower");
|
||||
floweringSlow = new AlleleInteger("floweringSlow", 15).setName("flowering", "slow");
|
||||
floweringAverage = new AlleleInteger("floweringAverage", 20).setName("flowering", "average");
|
||||
floweringFast = new AlleleInteger("floweringFast", 25).setName("flowering", "fast");
|
||||
floweringFaster = new AlleleInteger("floweringFaster", 30).setName("flowering", "faster");
|
||||
floweringFastest = new AlleleInteger("floweringFastest", 35).setName("flowering", "fastest");
|
||||
floweringMaximum = new AlleleInteger("floweringMaximum", 99, true).setName("flowering", "maximum");
|
||||
|
||||
// BOTH // TERRITORY
|
||||
territoryDefault = new AlleleArea("territoryDefault", new int[] {9, 6, 9}).setName("gui.average");
|
||||
territoryLarge = new AlleleArea("territoryLarge", new int[] {11, 8, 11}).setName("gui.large");
|
||||
territoryLarger = new AlleleArea("territoryLarger", new int[] {13, 12, 13}).setName("gui.larger");
|
||||
territoryLargest = new AlleleArea("territoryLargest", new int[] {15, 13, 15}).setName("gui.largest");
|
||||
territoryDefault = new AlleleArea("territoryDefault", new int[] {9, 6, 9}).setName("territory", "average");
|
||||
territoryLarge = new AlleleArea("territoryLarge", new int[] {11, 8, 11}).setName("territory", "large");
|
||||
territoryLarger = new AlleleArea("territoryLarger", new int[] {13, 12, 13}).setName("territory", "larger");
|
||||
territoryLargest = new AlleleArea("territoryLargest", new int[] {15, 13, 15}).setName("territory", "largest");
|
||||
|
||||
// TREES // PLANTS
|
||||
plantTypeNone = new AllelePlantType("plantTypeNone", EnumSet.noneOf(EnumPlantType.class), true);
|
||||
plantTypePlains = new AllelePlantType("plantTypePlains", EnumPlantType.Plains);
|
||||
;
|
||||
|
||||
plantTypeDesert = new AllelePlantType("plantTypeDesert", EnumPlantType.Desert);
|
||||
plantTypeBeach = new AllelePlantType("plantTypeBeach", EnumPlantType.Beach);
|
||||
plantTypeCave = new AllelePlantType("plantTypeCave", EnumPlantType.Cave);
|
||||
@@ -550,6 +554,9 @@ public class Allele implements IAllele {
|
||||
plantTypeNether = new AllelePlantType("plantTypeNether", EnumPlantType.Nether);
|
||||
plantTypeCrop = new AllelePlantType("plantTypeCrop", EnumPlantType.Crop);
|
||||
|
||||
fireproofFalse = new AlleleBoolean("fireproofFalse", false);
|
||||
fireproofTrue = new AlleleBoolean("fireproofTrue", true);
|
||||
|
||||
// LEGACY MAPPINGS
|
||||
ILegacyHandler legacy = (ILegacyHandler) AlleleManager.alleleRegistry;
|
||||
|
||||
@@ -688,7 +695,7 @@ public class Allele implements IAllele {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return StringUtil.localize(name);
|
||||
return StringUtil.localize(getUnlocalizedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.core.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleArea;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Vect;
|
||||
|
||||
public class AlleleArea extends Allele implements IAlleleArea {
|
||||
@@ -34,4 +35,13 @@ public class AlleleArea extends Allele implements IAlleleArea {
|
||||
return new Vect(area);
|
||||
}
|
||||
|
||||
public AlleleArea setName(String customPrefix, String name) {
|
||||
String customName = "gui." + customPrefix + "." + name;
|
||||
if (StringUtil.canTranslate(customName))
|
||||
this.name = customName;
|
||||
else
|
||||
this.name = "gui." + name;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.core.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class AlleleFloat extends Allele implements IAlleleFloat {
|
||||
|
||||
@@ -30,4 +31,12 @@ public class AlleleFloat extends Allele implements IAlleleFloat {
|
||||
return value;
|
||||
}
|
||||
|
||||
public AlleleFloat setName(String customPrefix, String name) {
|
||||
String customName = "gui." + customPrefix + "." + name;
|
||||
if (StringUtil.canTranslate(customName))
|
||||
this.name = customName;
|
||||
else
|
||||
this.name = "gui." + name;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.core.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class AlleleInteger extends Allele implements IAlleleInteger {
|
||||
|
||||
@@ -30,4 +31,13 @@ public class AlleleInteger extends Allele implements IAlleleInteger {
|
||||
return value;
|
||||
}
|
||||
|
||||
public AlleleInteger setName(String customPrefix, String name) {
|
||||
String customName = "gui." + customPrefix + "." + name;
|
||||
if (StringUtil.canTranslate(customName))
|
||||
this.name = customName;
|
||||
else
|
||||
this.name = "gui." + name;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -36,7 +35,6 @@ import forestry.core.utils.StringUtil;
|
||||
|
||||
public abstract class AlleleSpecies extends Allele implements IAlleleSpecies {
|
||||
|
||||
private final String name;
|
||||
private final String binomial;
|
||||
private String description = null;
|
||||
private int complexity = 3;
|
||||
@@ -58,16 +56,6 @@ public abstract class AlleleSpecies extends Allele implements IAlleleSpecies {
|
||||
AlleleManager.alleleRegistry.registerAllele(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return StringUtil.localize(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
|
||||
@@ -30,44 +30,43 @@ public class AlleleTolerance extends Allele implements IAlleleTolerance {
|
||||
public EnumTolerance getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
switch(value) {
|
||||
case BOTH_1:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.both1");
|
||||
case BOTH_2:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.both2");
|
||||
case BOTH_3:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.both3");
|
||||
case BOTH_4:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.both4");
|
||||
case BOTH_5:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.both5");
|
||||
case DOWN_1:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.down1");
|
||||
case DOWN_2:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.down2");
|
||||
case DOWN_3:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.down3");
|
||||
case DOWN_4:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.down4");
|
||||
case DOWN_5:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.down5");
|
||||
case NONE:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.none");
|
||||
case UP_1:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.up1");
|
||||
case UP_2:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.up2");
|
||||
case UP_3:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.up3");
|
||||
case UP_4:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.up4");
|
||||
case UP_5:
|
||||
return StringUtil.localize("gui.beealyzer.tolerance.up5");
|
||||
default:
|
||||
return "";
|
||||
|
||||
case BOTH_1:
|
||||
return "gui.beealyzer.tolerance.both1";
|
||||
case BOTH_2:
|
||||
return "gui.beealyzer.tolerance.both2";
|
||||
case BOTH_3:
|
||||
return "gui.beealyzer.tolerance.both3";
|
||||
case BOTH_4:
|
||||
return "gui.beealyzer.tolerance.both4";
|
||||
case BOTH_5:
|
||||
return "gui.beealyzer.tolerance.both5";
|
||||
case DOWN_1:
|
||||
return "gui.beealyzer.tolerance.down1";
|
||||
case DOWN_2:
|
||||
return "gui.beealyzer.tolerance.down2";
|
||||
case DOWN_3:
|
||||
return "gui.beealyzer.tolerance.down3";
|
||||
case DOWN_4:
|
||||
return "gui.beealyzer.tolerance.down4";
|
||||
case DOWN_5:
|
||||
return "gui.beealyzer.tolerance.down5";
|
||||
case NONE:
|
||||
return "gui.beealyzer.tolerance.none";
|
||||
case UP_1:
|
||||
return "gui.beealyzer.tolerance.up1";
|
||||
case UP_2:
|
||||
return "gui.beealyzer.tolerance.up2";
|
||||
case UP_3:
|
||||
return "gui.beealyzer.tolerance.up3";
|
||||
case UP_4:
|
||||
return "gui.beealyzer.tolerance.up4";
|
||||
case UP_5:
|
||||
return "gui.beealyzer.tolerance.up5";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,14 +10,18 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.genetics;
|
||||
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.apiculture.items.ItemBeeGE;
|
||||
import forestry.core.config.Config;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.core.config.Config;
|
||||
|
||||
public abstract class Genome implements IGenome {
|
||||
|
||||
private static final String SLOT_TAG = "Slot";
|
||||
@@ -40,6 +44,38 @@ public abstract class Genome implements IGenome {
|
||||
this.chromosomes = chromosomes;
|
||||
}
|
||||
|
||||
// NBT RETRIEVAL
|
||||
public static Chromosome getChromosome(ItemStack itemStack, IChromosomeType chromosomeType) {
|
||||
NBTTagCompound nbtTagCompound = itemStack.getTagCompound();
|
||||
if (nbtTagCompound == null)
|
||||
return null;
|
||||
|
||||
NBTTagCompound genome = nbtTagCompound.getCompoundTag("Genome");
|
||||
if (genome == null)
|
||||
return null;
|
||||
|
||||
NBTTagList chromosomes = genome.getTagList("Chromosomes", 10);
|
||||
if (chromosomes == null)
|
||||
return null;
|
||||
|
||||
for (int i = 0; i < chromosomes.tagCount(); i++) {
|
||||
NBTTagCompound chromosomeTag = chromosomes.getCompoundTagAt(i);
|
||||
byte byte0 = chromosomeTag.getByte(SLOT_TAG);
|
||||
|
||||
if (byte0 == chromosomeType.ordinal()) {
|
||||
return Chromosome.loadChromosomeFromNBT(chromosomeTag);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IAllele getPrimaryAllele(ItemStack itemStack, IChromosomeType chromosomeType) {
|
||||
Chromosome chromosome = getChromosome(itemStack, chromosomeType);
|
||||
if (chromosome == null)
|
||||
return null;
|
||||
return chromosome.getPrimaryAllele();
|
||||
}
|
||||
|
||||
// / SAVING & LOADING
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
@@ -61,6 +97,17 @@ public abstract class Genome implements IGenome {
|
||||
throw new RuntimeException("Found Chromosome with invalid Alleles. See config option \"genetics.clear.invalid.chromosomes\".");
|
||||
}
|
||||
}
|
||||
|
||||
// handle old saves that have missing chromosomes
|
||||
IChromosome speciesChromosome = chromosomes[EnumTreeChromosome.SPECIES.ordinal()];
|
||||
if (speciesChromosome != null) {
|
||||
IAlleleSpecies species = (IAlleleSpecies)speciesChromosome.getActiveAllele();
|
||||
IAllele[] template = getSpeciesRoot().getTemplate(species.getUID());
|
||||
for (int i = 0; i < chromosomes.length; i++) {
|
||||
if ((chromosomes[i] == null) && (template[i] != null))
|
||||
chromosomes[i] = new Chromosome(template[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,6 +39,8 @@ public abstract class ItemGE extends Item {
|
||||
|
||||
protected abstract IIndividual getIndividual(ItemStack itemstack);
|
||||
|
||||
protected abstract IAlleleSpecies getSpecies(ItemStack itemStack);
|
||||
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return false;
|
||||
@@ -56,11 +58,8 @@ public abstract class ItemGE extends Item {
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack itemstack, int pass) {
|
||||
if (!itemstack.hasTagCompound())
|
||||
return false;
|
||||
|
||||
IIndividual individual = getIndividual(itemstack);
|
||||
return individual.hasEffect();
|
||||
IAlleleSpecies species = getSpecies(itemstack);
|
||||
return species != null && species.hasEffect();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
|
||||
@@ -235,7 +235,12 @@ public class ItemResearchNote extends ItemForestry {
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
ResearchNote note = new ResearchNote(itemstack.getTagCompound());
|
||||
return StringUtil.localizeAndFormatRaw(getUnlocalizedName(itemstack) + ".name", note.researcher.getName());
|
||||
String researcherName;
|
||||
if (note.researcher == null)
|
||||
researcherName = "Sengir";
|
||||
else
|
||||
researcherName = note.researcher.getName();
|
||||
return StringUtil.localizeAndFormatRaw(getUnlocalizedName(itemstack) + ".name", researcherName);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
|
||||
Loaded 100 of 982 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user