mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-28 07:35:47 +00:00
Merge branch 'dev'
Conflicts: application.properties src/main/java/forestry/Forestry.java src/main/java/forestry/core/fluids/TankManager.java src/main/java/forestry/core/genetics/Allele.java src/main/java/forestry/factory/gadgets/MachineBottler.java src/main/java/forestry/factory/gadgets/MachineStill.java src/main/java/forestry/factory/gui/ContainerBottler.java src/main/java/forestry/plugins/PluginApiculture.java src/main/java/forestry/plugins/PluginCore.java src/main/java/forestry/plugins/PluginManager.java src/main/java/forestry/storage/items/ItemNaturalistBackpack.java
This commit is contained in:
commit
ce6aa27f44
372 files changed
+7241
-7083
No files matched your search
@@ -61,7 +61,8 @@ import forestry.core.utils.StringUtil;
|
||||
+ "after:ExtrabiomesXL;"
|
||||
+ "after:BiomesOPlenty;"
|
||||
+ "after:IC2@[2.0.140,);"
|
||||
+ "after:Natura@[2.2.0,);")
|
||||
+ "after:Natura@[2.2.0,);"
|
||||
+ "after:HardcoreEnderExpansion;")
|
||||
//, certificateFingerprint = Version.FINGERPRINT)
|
||||
public class Forestry {
|
||||
|
||||
|
||||
@@ -10,12 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.apiculture.IBee;
|
||||
@@ -33,10 +35,13 @@ import forestry.plugins.PluginApiculture;
|
||||
public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
private static final int MAX_POLLINATION_ATTEMPTS = 20;
|
||||
private static final int totalBreedingTime = Defaults.APIARY_BREEDING_TIME;
|
||||
|
||||
private final IBeeHousing housing;
|
||||
private final boolean housingSupportsMultipleErrorStates;
|
||||
|
||||
// Breeding
|
||||
private int breedingTime;
|
||||
private final int totalBreedingTime = Defaults.APIARY_BREEDING_TIME;
|
||||
private int queenWorkCycleThrottle;
|
||||
private IEffectData effectData[] = new IEffectData[2];
|
||||
private IBee queen;
|
||||
@@ -46,6 +51,14 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
public BeekeepingLogic(IBeeHousing housing) {
|
||||
this.housing = housing;
|
||||
|
||||
Set<IErrorState> errorStateSet = null;
|
||||
try {
|
||||
errorStateSet = housing.getErrorStates();
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
housingSupportsMultipleErrorStates = (errorStateSet != null);
|
||||
}
|
||||
|
||||
// / SAVING & LOADING
|
||||
@@ -86,7 +99,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
@Override
|
||||
public int getTotalBreedingTime() {
|
||||
return this.totalBreedingTime;
|
||||
return totalBreedingTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,6 +121,13 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
@Override
|
||||
public void update() {
|
||||
|
||||
if (housingSupportsMultipleErrorStates) {
|
||||
Set<IErrorState> errorStates = housing.getErrorStates();
|
||||
for (IErrorState errorState : errorStates) {
|
||||
housing.setErrorCondition(false, errorState);
|
||||
}
|
||||
}
|
||||
|
||||
this.queen = null;
|
||||
|
||||
if (!addPendingProducts()) {
|
||||
@@ -117,7 +137,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
if (tryBreedingPrincess() || !hasHealthyQueen()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!queenCanWork()) {
|
||||
return;
|
||||
}
|
||||
@@ -133,25 +153,32 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
queenWorkCycleThrottle++;
|
||||
if (queenWorkCycleThrottle >= PluginApiculture.ticksPerBeeWorkCycle) {
|
||||
queenWorkCycleThrottle = 0;
|
||||
|
||||
// Need a flower
|
||||
if (queen.hasFlower(housing)) {
|
||||
housing.setErrorState(EnumErrorCode.OK.ordinal());
|
||||
doQueenWorkCycle();
|
||||
|
||||
boolean hasFlower = queen.hasFlower(housing);
|
||||
|
||||
if (housingSupportsMultipleErrorStates) {
|
||||
housing.setErrorCondition(!hasFlower, EnumErrorCode.NOFLOWER);
|
||||
} else {
|
||||
housing.setErrorState(EnumErrorCode.NOFLOWER.ordinal());
|
||||
if (hasFlower) {
|
||||
housing.setErrorState(EnumErrorCode.OK);
|
||||
} else {
|
||||
housing.setErrorState(EnumErrorCode.NOFLOWER);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasFlower) {
|
||||
return;
|
||||
}
|
||||
|
||||
doProduction();
|
||||
queen.plantFlowerRandom(housing);
|
||||
doPollination();
|
||||
|
||||
// Age the queen
|
||||
queen.age(housing.getWorld(), housing.getLifespanModifier(queen.getGenome(), queen.getMate(), 0f));
|
||||
updateQueenItemNBT();
|
||||
}
|
||||
}
|
||||
|
||||
private void doQueenWorkCycle() {
|
||||
doProduction();
|
||||
queen.plantFlowerRandom(housing);
|
||||
doPollination();
|
||||
// Age the queen
|
||||
queen.age(housing.getWorld(), housing.getLifespanModifier(queen.getGenome(), queen.getMate(), 0f));
|
||||
updateQueenItemNBT();
|
||||
}
|
||||
|
||||
private void doProduction() {
|
||||
// Produce and add stacks
|
||||
@@ -203,10 +230,11 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
}
|
||||
|
||||
if (housingErrorState != null) {
|
||||
try {
|
||||
if (housingSupportsMultipleErrorStates) {
|
||||
boolean hasSpace = (housingErrorState == EnumErrorCode.OK);
|
||||
housing.setErrorCondition(!hasSpace, EnumErrorCode.NOSPACE);
|
||||
} else {
|
||||
housing.setErrorState(housingErrorState);
|
||||
} catch (Error e) {
|
||||
housing.setErrorState(housingErrorState.ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,7 +249,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
housingErrorState = EnumErrorCode.NOQUEEN;
|
||||
hasQueen = false;
|
||||
} else {
|
||||
IBee queen = PluginApiculture.beeInterface.getMember(housing.getQueen());
|
||||
IBee queen = BeeManager.beeRoot.getMember(housing.getQueen());
|
||||
// Kill dying queens
|
||||
if (!queen.isAlive()) {
|
||||
killQueen(queen);
|
||||
@@ -231,13 +259,15 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
this.queen = queen;
|
||||
}
|
||||
}
|
||||
if (housingErrorState != null) {
|
||||
try {
|
||||
|
||||
if (housingSupportsMultipleErrorStates) {
|
||||
housing.setErrorCondition(!hasQueen, EnumErrorCode.NOQUEEN);
|
||||
} else {
|
||||
if (housingErrorState != null) {
|
||||
housing.setErrorState(housingErrorState);
|
||||
} catch (Error e) {
|
||||
housing.setErrorState(housingErrorState.ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
return hasQueen;
|
||||
}
|
||||
|
||||
@@ -246,10 +276,15 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
// Princess available? Try to breed!
|
||||
if (ForestryItem.beePrincessGE.isItemEqual(housing.getQueen())) {
|
||||
if (ForestryItem.beeDroneGE.isItemEqual(housing.getDrone())) {
|
||||
housing.setErrorState(EnumErrorCode.OK.ordinal());
|
||||
boolean hasDrone = ForestryItem.beeDroneGE.isItemEqual(housing.getDrone());
|
||||
if (housingSupportsMultipleErrorStates) {
|
||||
housing.setErrorCondition(!hasDrone, EnumErrorCode.NODRONE);
|
||||
} else {
|
||||
housing.setErrorState(EnumErrorCode.NODRONE.ordinal());
|
||||
if (hasDrone) {
|
||||
housing.setErrorState(EnumErrorCode.OK);
|
||||
} else {
|
||||
housing.setErrorState(EnumErrorCode.NODRONE);
|
||||
}
|
||||
}
|
||||
tickBreed();
|
||||
isBreedingPrincess = true;
|
||||
@@ -259,35 +294,27 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
}
|
||||
|
||||
private boolean queenCanWork() {
|
||||
try {
|
||||
boolean canWork = true;
|
||||
// Not while raining, at night or without light
|
||||
IErrorState state = queen.canWork(housing);
|
||||
if (state != EnumErrorCode.OK) {
|
||||
housing.setErrorState(state);
|
||||
canWork = false;
|
||||
} else if (housing.getErrorState() != EnumErrorCode.NOFLOWER) {
|
||||
housing.setErrorState(EnumErrorCode.OK);
|
||||
}
|
||||
return canWork;
|
||||
} catch (Error e) {
|
||||
Proxies.log.logErrorAPI("Forestry", e, IBee.class);
|
||||
return queenCanWorkDeprecated();
|
||||
}
|
||||
}
|
||||
|
||||
// fallback for outdated APIs
|
||||
private boolean queenCanWorkDeprecated() {
|
||||
boolean canWork = true;
|
||||
// Not while raining, at night or without light
|
||||
EnumErrorCode state = EnumErrorCode.values()[queen.isWorking(housing)];
|
||||
if (state != EnumErrorCode.OK) {
|
||||
housing.setErrorState(state.ordinal());
|
||||
canWork = false;
|
||||
} else if (housing.getErrorOrdinal() != EnumErrorCode.NOFLOWER.ordinal()) {
|
||||
housing.setErrorState(EnumErrorCode.OK.ordinal());
|
||||
if (housingSupportsMultipleErrorStates) {
|
||||
try {
|
||||
Set<IErrorState> errorStates = queen.getCanWork(housing);
|
||||
for (IErrorState errorState : errorStates) {
|
||||
housing.setErrorCondition(true, errorState);
|
||||
}
|
||||
|
||||
return (errorStates.size() == 0);
|
||||
} catch (Throwable ignored) {
|
||||
// queen might not support getCanWork(housing)
|
||||
}
|
||||
}
|
||||
return canWork;
|
||||
|
||||
IErrorState state = queen.canWork(housing);
|
||||
if (state != EnumErrorCode.OK) {
|
||||
housing.setErrorState(state);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// / BREEDING
|
||||
@@ -310,8 +337,8 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
}
|
||||
|
||||
// Replace
|
||||
IBee princess = PluginApiculture.beeInterface.getMember(housing.getQueen());
|
||||
IBee drone = PluginApiculture.beeInterface.getMember(housing.getDrone());
|
||||
IBee princess = BeeManager.beeRoot.getMember(housing.getQueen());
|
||||
IBee drone = BeeManager.beeRoot.getMember(housing.getDrone());
|
||||
princess.mate(drone);
|
||||
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
@@ -323,7 +350,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
housing.onQueenChange(housing.getQueen());
|
||||
|
||||
// Register the new queen with the breeding tracker
|
||||
PluginApiculture.beeInterface.getBreedingTracker(housing.getWorld(), housing.getOwnerName()).registerQueen(princess);
|
||||
BeeManager.beeRoot.getBreedingTracker(housing.getWorld(), housing.getOwnerName()).registerQueen(princess);
|
||||
|
||||
// Remove drone
|
||||
housing.getDrone().stackSize--;
|
||||
@@ -376,18 +403,18 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
private void spawnOffspring(IBee queen) {
|
||||
|
||||
Stack<ItemStack> offspring = new Stack<ItemStack>();
|
||||
IApiaristTracker breedingTracker = PluginApiculture.beeInterface.getBreedingTracker(housing.getWorld(), housing.getOwnerName());
|
||||
IApiaristTracker breedingTracker = BeeManager.beeRoot.getBreedingTracker(housing.getWorld(), housing.getOwnerName());
|
||||
|
||||
housing.onQueenDeath(getQueen());
|
||||
|
||||
// Princess
|
||||
boolean secondPrincess = this.housing.getWorld().rand.nextInt(100) < PluginApiculture.getSecondPrincessChance();
|
||||
boolean secondPrincess = this.housing.getWorld().rand.nextInt(10000) < PluginApiculture.getSecondPrincessChance() * 100;
|
||||
int count = secondPrincess ? 2 : 1;
|
||||
while (count > 0) {
|
||||
count--;
|
||||
IBee heiress = queen.spawnPrincess(housing);
|
||||
if (heiress != null) {
|
||||
ItemStack princess = PluginApiculture.beeInterface.getMemberStack(heiress, EnumBeeType.PRINCESS.ordinal());
|
||||
ItemStack princess = BeeManager.beeRoot.getMemberStack(heiress, EnumBeeType.PRINCESS.ordinal());
|
||||
breedingTracker.registerPrincess(heiress);
|
||||
offspring.push(princess);
|
||||
}
|
||||
@@ -396,7 +423,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
// Drones
|
||||
IBee[] larvae = queen.spawnDrones(housing);
|
||||
for (IBee larva : larvae) {
|
||||
ItemStack drone = PluginApiculture.beeInterface.getMemberStack(larva, EnumBeeType.DRONE.ordinal());
|
||||
ItemStack drone = BeeManager.beeRoot.getMemberStack(larva, EnumBeeType.DRONE.ordinal());
|
||||
breedingTracker.registerDrone(larva);
|
||||
offspring.push(drone);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.apiculture.gadgets.TileAlvearyHygroregulator;
|
||||
import forestry.apiculture.gadgets.TileAlvearyPlain;
|
||||
import forestry.apiculture.gadgets.TileAlvearySieve;
|
||||
@@ -42,7 +43,6 @@ import forestry.apiculture.items.ItemImprinter.ImprinterInventory;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class GuiHandlerApiculture extends GuiHandlerBase {
|
||||
|
||||
@@ -90,7 +90,7 @@ public class GuiHandlerApiculture extends GuiHandlerBase {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new GuiHabitatLocator(player.inventory, new HabitatLocatorInventory(equipped));
|
||||
return new GuiHabitatLocator(player, new HabitatLocatorInventory(player, equipped));
|
||||
|
||||
case HygroregulatorGUI:
|
||||
return new GuiAlvearyHygroregulator(player.inventory, (TileAlvearyHygroregulator) getTileForestry(world, x, y, z));
|
||||
@@ -156,7 +156,7 @@ public class GuiHandlerApiculture extends GuiHandlerBase {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ContainerHabitatLocator(player.inventory, new HabitatLocatorInventory(equipped));
|
||||
return new ContainerHabitatLocator(player, new HabitatLocatorInventory(player, equipped));
|
||||
|
||||
case HygroregulatorGUI:
|
||||
return new ContainerAlvearyHygroregulator(player.inventory, (TileAlvearyHygroregulator) getTileForestry(world, x, y, z));
|
||||
@@ -175,7 +175,7 @@ public class GuiHandlerApiculture extends GuiHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
private void synchApiaristTracker(World world, EntityPlayer player) {
|
||||
PluginApiculture.beeInterface.getBreedingTracker(world, player.getGameProfile()).synchToPlayer(player);
|
||||
private static void synchApiaristTracker(World world, EntityPlayer player) {
|
||||
BeeManager.beeRoot.getBreedingTracker(world, player.getGameProfile()).synchToPlayer(player);
|
||||
}
|
||||
}
|
||||
@@ -12,14 +12,14 @@ package forestry.apiculture;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.core.interfaces.ISaveEventHandler;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class SaveEventHandlerApiculture implements ISaveEventHandler {
|
||||
|
||||
@Override
|
||||
public void onWorldLoad(World world) {
|
||||
PluginApiculture.beeInterface.resetBeekeepingMode();
|
||||
BeeManager.beeRoot.resetBeekeepingMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,14 +27,13 @@ import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.apiculture.genetics.BeeTemplates;
|
||||
import forestry.apiculture.genetics.BeeDefinition;
|
||||
import forestry.apiculture.items.ItemHoneycomb;
|
||||
import forestry.apiculture.worldgen.ComponentVillageBeeHouse;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class VillageHandlerApiculture implements IVillageCreationHandler, IVillageTradeHandler {
|
||||
|
||||
@@ -53,10 +52,7 @@ public class VillageHandlerApiculture implements IVillageCreationHandler, IVilla
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.wheat, 2), ItemHoneycomb.getRandomComb(1, random, false)));
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Blocks.log, 24, Defaults.WILDCARD), ForestryBlock.apiculture.getItemStack(1, Defaults.DEFINITION_APIARY_META)));
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1), ForestryItem.frameProven.getItemStack(6)));
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 12), ForestryItem.beePrincessGE.getItemStack(1, Defaults.WILDCARD),
|
||||
PluginApiculture.beeInterface.getMemberStack(
|
||||
PluginApiculture.beeInterface.getBee(villager.worldObj, PluginApiculture.beeInterface.templateAsGenome(BeeTemplates.getMonasticTemplate())),
|
||||
EnumBeeType.DRONE.ordinal())));
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 12), ForestryItem.beePrincessGE.getItemStack(1, Defaults.WILDCARD), BeeDefinition.MONASTIC.getMemberStack(EnumBeeType.DRONE)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,15 +15,15 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.core.commands.ICommandModeHelper;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class BeeModeHelper implements ICommandModeHelper {
|
||||
|
||||
@Override
|
||||
public String[] getModeNames() {
|
||||
ArrayList<IBeekeepingMode> beekeepingModes = PluginApiculture.beeInterface.getBeekeepingModes();
|
||||
ArrayList<IBeekeepingMode> beekeepingModes = BeeManager.beeRoot.getBeekeepingModes();
|
||||
int modeStringCount = beekeepingModes.size();
|
||||
List<String> modeStrings = new ArrayList<String>(modeStringCount);
|
||||
for (IBeekeepingMode mode : beekeepingModes) {
|
||||
@@ -35,7 +35,7 @@ public class BeeModeHelper implements ICommandModeHelper {
|
||||
|
||||
@Override
|
||||
public String getModeNameMatching(String desired) {
|
||||
IBeekeepingMode mode = PluginApiculture.beeInterface.getBeekeepingMode(desired);
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getBeekeepingMode(desired);
|
||||
if (mode == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -44,17 +44,17 @@ public class BeeModeHelper implements ICommandModeHelper {
|
||||
|
||||
@Override
|
||||
public String getModeName(World world) {
|
||||
return PluginApiculture.beeInterface.getBeekeepingMode(world).getName();
|
||||
return BeeManager.beeRoot.getBeekeepingMode(world).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMode(World world, String modeName) {
|
||||
PluginApiculture.beeInterface.setBeekeepingMode(world, modeName);
|
||||
BeeManager.beeRoot.setBeekeepingMode(world, modeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getDescription(String modeName) {
|
||||
IBeekeepingMode mode = PluginApiculture.beeInterface.getBeekeepingMode(modeName);
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getBeekeepingMode(modeName);
|
||||
return mode.getDescription();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
@@ -26,7 +27,6 @@ import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.core.commands.IStatsSaveHelper;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class BeeStatsSaveHelper implements IStatsSaveHelper {
|
||||
|
||||
@@ -69,7 +69,7 @@ public class BeeStatsSaveHelper implements IStatsSaveHelper {
|
||||
|
||||
@Override
|
||||
public IBreedingTracker getBreedingTracker(World world, GameProfile gameProfile) {
|
||||
return PluginApiculture.beeInterface.getBreedingTracker(world, gameProfile);
|
||||
return BeeManager.beeRoot.getBreedingTracker(world, gameProfile);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
@@ -28,7 +29,6 @@ import forestry.core.commands.CommandHelpers;
|
||||
import forestry.core.commands.SpeciesNotFoundException;
|
||||
import forestry.core.commands.SubCommand;
|
||||
import forestry.core.commands.TemplateNotFoundException;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class CommandBeeGive extends SubCommand {
|
||||
|
||||
@@ -87,13 +87,13 @@ public class CommandBeeGive extends SubCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
IBee bee = PluginApiculture.beeInterface.getBee(player.worldObj, beeGenome);
|
||||
IBee bee = BeeManager.beeRoot.getBee(player.worldObj, beeGenome);
|
||||
|
||||
if (beeType == EnumBeeType.QUEEN) {
|
||||
bee.mate(bee);
|
||||
}
|
||||
|
||||
ItemStack beeStack = PluginApiculture.beeInterface.getMemberStack(bee, beeType.ordinal());
|
||||
ItemStack beeStack = BeeManager.beeRoot.getMemberStack(bee, beeType.ordinal());
|
||||
player.dropPlayerItemWithRandomChoice(beeStack, true);
|
||||
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.bee.give.given", player.getCommandSenderName(), bee.getGenome().getPrimary().getName(), beeType.getName());
|
||||
@@ -127,13 +127,13 @@ public class CommandBeeGive extends SubCommand {
|
||||
throw new SpeciesNotFoundException(speciesName);
|
||||
}
|
||||
|
||||
IAllele[] template = PluginApiculture.beeInterface.getTemplate(species.getUID());
|
||||
IAllele[] template = BeeManager.beeRoot.getTemplate(species.getUID());
|
||||
|
||||
if (template == null) {
|
||||
throw new TemplateNotFoundException(species);
|
||||
}
|
||||
|
||||
return PluginApiculture.beeInterface.templateAsGenome(template);
|
||||
return BeeManager.beeRoot.templateAsGenome(template);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,12 +18,12 @@ import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.utils.ForestryResource;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class EntityBee extends EntityCreature implements IAnimals {
|
||||
|
||||
@@ -48,7 +48,7 @@ public class EntityBee extends EntityCreature implements IAnimals {
|
||||
if (bee != null) {
|
||||
contained = bee;
|
||||
} else {
|
||||
contained = PluginApiculture.beeInterface.templateAsIndividual(PluginApiculture.beeInterface.getDefaultTemplate());
|
||||
contained = BeeManager.beeRoot.templateAsIndividual(BeeManager.beeRoot.getDefaultTemplate());
|
||||
}
|
||||
|
||||
//isImmuneToFire = contained.getGenome().getFireResist();
|
||||
|
||||
@@ -10,11 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -27,10 +33,10 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -38,14 +44,42 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.ForestryClient;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class BlockCandle extends BlockTorch {
|
||||
|
||||
private final ArrayList<Item> lightingItems = new ArrayList<Item>();
|
||||
private static final ImmutableMap<String, Integer> colours;
|
||||
private static final Set<Item> lightingItems;
|
||||
public static final String colourTagName = "colour";
|
||||
|
||||
static {
|
||||
colours = ImmutableMap.<String, Integer>builder()
|
||||
.put("dyeWhite", new Color(255, 255, 255).getRGB())
|
||||
.put("dyeOrange", new Color(219, 125, 62).getRGB())
|
||||
.put("dyeMagenta", new Color(255, 20, 255).getRGB())
|
||||
.put("dyeLightBlue", new Color(107, 138, 201).getRGB())
|
||||
.put("dyeYellow", new Color(255, 255, 20).getRGB())
|
||||
.put("dyeLime", new Color(20, 255, 20).getRGB())
|
||||
.put("dyePink", new Color(208, 132, 153).getRGB())
|
||||
.put("dyeGray", new Color(74, 74, 74).getRGB())
|
||||
.put("dyeLightGray", new Color(154, 161, 161).getRGB())
|
||||
.put("dyeCyan", new Color(20, 255, 255).getRGB())
|
||||
.put("dyePurple", new Color(126, 61, 181).getRGB())
|
||||
.put("dyeBlue", new Color(20, 20, 255).getRGB())
|
||||
.put("dyeBrown", new Color(79, 50, 31).getRGB())
|
||||
.put("dyeGreen", new Color(53, 70, 27).getRGB())
|
||||
.put("dyeRed", new Color(150, 52, 48).getRGB())
|
||||
.put("dyeBlack", new Color(20, 20, 20).getRGB())
|
||||
.build();
|
||||
|
||||
lightingItems = new HashSet<Item>(Arrays.asList(
|
||||
Items.flint_and_steel,
|
||||
Items.flint,
|
||||
Item.getItemFromBlock(Blocks.torch)
|
||||
));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon litStump;
|
||||
@@ -61,10 +95,6 @@ public class BlockCandle extends BlockTorch {
|
||||
this.setHardness(0.0F);
|
||||
this.setStepSound(soundTypeWood);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
|
||||
lightingItems.add(Items.flint_and_steel);
|
||||
lightingItems.add(Items.flint);
|
||||
lightingItems.add(Item.getItemFromBlock(Blocks.torch));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,31 +125,24 @@ public class BlockCandle extends BlockTorch {
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return (isLit(meta)) ? 14 : 0;
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileCandle && ((TileCandle) tileEntity).isLit()) {
|
||||
return 14;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
IIcon i = this.unlitStump;
|
||||
if (this.isLit(world.getBlockMetadata(x, y, z))) {
|
||||
i = this.litStump;
|
||||
}
|
||||
return i;
|
||||
}*/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getTextureFromPassAndMeta(int meta, int pass) {
|
||||
public IIcon getTextureFromPassAndLit(int pass, boolean isLit) {
|
||||
IIcon i;
|
||||
if (pass == 0) {
|
||||
if (isLit(meta)) {
|
||||
if (isLit) {
|
||||
i = this.litTip;
|
||||
} else {
|
||||
i = this.unlitTip;
|
||||
}
|
||||
} else {
|
||||
if (isLit(meta)) {
|
||||
if (isLit) {
|
||||
i = this.litStump;
|
||||
} else {
|
||||
i = this.unlitStump;
|
||||
@@ -128,232 +151,157 @@ public class BlockCandle extends BlockTorch {
|
||||
return i;
|
||||
}
|
||||
|
||||
public int getColourFromItemStack(ItemStack stack) {
|
||||
int colour = 0xffffff;
|
||||
if (stack.hasTagCompound()) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
colour = (tag.getByte("red") << 16) | (tag.getByte("green") << 8) | tag.getByte("blue");
|
||||
}
|
||||
return colour;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
itemList.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
|
||||
// Dye names correspond to colour values as below.
|
||||
private static final String[] dyes = {"dyeWhite", "dyeOrange", "dyeMagenta", "dyeLightBlue",
|
||||
"dyeYellow", "dyeLime", "dyePink", "dyeGray",
|
||||
"dyeLightGray", "dyeCyan", "dyePurple", "dyeBlue",
|
||||
"dyeBrown", "dyeGreen", "dyeRed", "dyeBlack"};
|
||||
|
||||
private static final int[][] colours = {{255, 255, 255}, {219, 125, 62}, {255, 20, 255}, {107, 138, 201},
|
||||
{255, 255, 20}, {20, 255, 20}, {208, 132, 153}, {74, 74, 74},
|
||||
{154, 161, 161}, {20, 255, 255}, {126, 61, 181}, {20, 20, 255},
|
||||
{79, 50, 31}, {53, 70, 27}, {150, 52, 48}, {20, 20, 20}};
|
||||
|
||||
public static final String colourTagName = "colour";
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float facingX, float facingY, float facingZ) {
|
||||
boolean flag = false;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
boolean toggleLitState = true;
|
||||
ItemStack held = player.getCurrentEquippedItem();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (!(tileEntity instanceof TileCandle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isLit(meta)) {
|
||||
if (held == null || !lightingItems.contains(held.getItem())) {
|
||||
TileCandle tileCandle = (TileCandle) tileEntity;
|
||||
final boolean isLit = tileCandle.isLit();
|
||||
|
||||
boolean flag = false;
|
||||
boolean toggleLitState = true;
|
||||
ItemStack heldItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (!isLit) {
|
||||
if (heldItem == null || !lightingItems.contains(heldItem.getItem())) {
|
||||
toggleLitState = false;
|
||||
} else if (StackUtils.equals(this, held) && isLit(held)) {
|
||||
} else if (StackUtils.equals(this, heldItem) && isLit(heldItem)) {
|
||||
toggleLitState = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (held != null) {
|
||||
// Ensure a TileEntity exists. May be able to remove this in future versions.
|
||||
TileCandle te = (TileCandle) world.getTileEntity(x, y, z);
|
||||
if (te == null) {
|
||||
world.setTileEntity(x, y, z, this.createTileEntity(world, meta));
|
||||
te = (TileCandle) world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
if (StackUtils.equals(this, held)) {
|
||||
if (!isLit(held)) {
|
||||
if (heldItem != null) {
|
||||
if (StackUtils.equals(this, heldItem)) {
|
||||
if (!isLit(heldItem)) {
|
||||
// Copy the colour of an unlit, coloured candle.
|
||||
if (held.hasTagCompound() && held.getTagCompound().hasKey(colourTagName)) {
|
||||
te.setColour(held.getTagCompound().getInteger(colourTagName));
|
||||
if (heldItem.hasTagCompound() && heldItem.getTagCompound().hasKey(colourTagName)) {
|
||||
tileCandle.setColour(heldItem.getTagCompound().getInteger(colourTagName));
|
||||
} else {
|
||||
// Reset to white if item has no
|
||||
te.setColour(0xffffff);
|
||||
tileCandle.setColour(0xffffff);
|
||||
}
|
||||
} else {
|
||||
toggleLitState = true;
|
||||
}
|
||||
flag = true;
|
||||
} else {
|
||||
// Check for dye-able ness.
|
||||
boolean matched = false;
|
||||
for (int i = 0; i < dyes.length; ++i) {
|
||||
for (ItemStack stack : OreDictionary.getOres(dyes[i])) {
|
||||
if (OreDictionary.itemMatches(stack, held, true)) {
|
||||
if (isLit(meta)) {
|
||||
te.setColour(colours[i][0], colours[i][1], colours[i][2]);
|
||||
} else {
|
||||
te.addColour(colours[i][0], colours[i][1], colours[i][2]);
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
matched = true;
|
||||
toggleLitState = false;
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (matched) {
|
||||
break;
|
||||
}
|
||||
boolean dyed = tryDye(heldItem, isLit, tileCandle);
|
||||
if (dyed) {
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
toggleLitState = false;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (toggleLitState) {
|
||||
meta = this.toggleLitStatus(meta);
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta, Defaults.FLAG_BLOCK_SYNCH | Defaults.FLAG_BLOCK_UPDATE);
|
||||
tileCandle.setLit(!isLit);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
if (!world.isRemote) {
|
||||
TileCandle tc = (TileCandle) world.getTileEntity(x, y, z);
|
||||
int newMeta = isLit(meta) ? 1 : 0;
|
||||
ItemStack stack = new ItemStack(this, 1, newMeta);
|
||||
if (tc != null && tc.getColour() != 0xffffff) {
|
||||
// When dropped, tag new item stack with colour. Unless it's white, then do no such thing for maximum stacking.
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger(colourTagName, tc.getColour());
|
||||
stack.setTagCompound(tag);
|
||||
private static boolean tryDye(ItemStack held, boolean isLit, TileCandle tileCandle) {
|
||||
// Check for dye-able ness.
|
||||
boolean matched = false;
|
||||
for (Map.Entry<String, Integer> colour : colours.entrySet()) {
|
||||
String colourName = colour.getKey();
|
||||
for (ItemStack stack : OreDictionary.getOres(colourName)) {
|
||||
if (OreDictionary.itemMatches(stack, held, true)) {
|
||||
if (isLit) {
|
||||
tileCandle.setColour(colour.getValue());
|
||||
} else {
|
||||
tileCandle.addColour(colour.getValue());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
this.dropBlockAsItem(world, x, y, z, stack);
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* DROP HANDLING */
|
||||
// Hack: When harvesting we need to get the drops in onBlockHarvested,
|
||||
// because Mojang destroys the block and tile before calling getDrops.
|
||||
protected ThreadLocal<ItemStack> drop = new ThreadLocal<ItemStack>();
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int metadata, EntityPlayer player) {
|
||||
if (!world.isRemote) {
|
||||
ItemStack itemStack = getCandleDrop(world, x, y, z);
|
||||
drop.set(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ItemStack dropStack = drop.get();
|
||||
drop.remove();
|
||||
|
||||
// not harvested, get drops normally
|
||||
if (dropStack == null) {
|
||||
dropStack = getCandleDrop(world, x, y, z);
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>(1);
|
||||
drops.add(dropStack);
|
||||
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return getCandleDrop(world, x, y, z);
|
||||
}
|
||||
|
||||
private ItemStack getCandleDrop(World world, int x, int y, int z) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (!(tileEntity instanceof TileCandle)) {
|
||||
return null;
|
||||
}
|
||||
TileCandle tileCandle = (TileCandle) tileEntity;
|
||||
int colour = tileCandle.getColour();
|
||||
|
||||
int newMeta = tileCandle.isLit() ? 1 : 0;
|
||||
ItemStack itemStack = new ItemStack(this, 1, newMeta);
|
||||
if (colour != 0xffffff) {
|
||||
// When dropped, tag new item stack with colour. Unless it's white, then do no such thing for maximum stacking.
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger(colourTagName, colour);
|
||||
itemStack.setTagCompound(tag);
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
TileCandle tc = (TileCandle) (world.getTileEntity(x, y, z));
|
||||
tc.setColour(this.getColourValueFromItemStack(itemStack));
|
||||
if (isLit(itemStack)) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
world.setBlockMetadataWithNotify(x, y, z, this.toggleLitStatus(meta), Defaults.FLAG_BLOCK_SYNCH | Defaults.FLAG_BLOCK_UPDATE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) {
|
||||
// Does nothing to prevent extra candles from falling.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) {
|
||||
// Does nothing to prevent extra candles from falling.
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean func_150109_e(World world, int x, int y, int z) {
|
||||
// Slightly tweaked version of BlockTorch's version to account for TE nonsense.
|
||||
if (!this.canPlaceBlockAt(world, x, y, z)) {
|
||||
if (world.getBlock(x, y, z) == this) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
TileCandle tileCandle = (TileCandle) (world.getTileEntity(x, y, z));
|
||||
int colour = getColourValueFromItemStack(itemStack);
|
||||
boolean isLit = isLit(itemStack);
|
||||
tileCandle.setColour(colour);
|
||||
tileCandle.setLit(isLit);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
||||
if (isLit(world.getBlockMetadata(x, y, z))) {
|
||||
int l = world.getBlockMetadata(x, y, z) & 0x07;
|
||||
double d0 = x + 0.5F;
|
||||
double d1 = y + 0.7F;
|
||||
double d2 = z + 0.5F;
|
||||
double d3 = 0.2199999988079071D;
|
||||
double d4 = 0.27000001072883606D;
|
||||
|
||||
if (l == 1) {
|
||||
world.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
} else if (l == 2) {
|
||||
world.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||
} else if (l == 3) {
|
||||
world.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
||||
} else if (l == 4) {
|
||||
world.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
||||
} else {
|
||||
world.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileCandle && ((TileCandle) tileEntity).isLit()) {
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean func_150108_b(World par1World, int par2, int par3, int par4, Block block) {
|
||||
if (this.func_150109_e(par1World, par2, par3, par4)) {
|
||||
int i1 = par1World.getBlockMetadata(par2, par3, par4) & 0x07;
|
||||
boolean flag = false;
|
||||
|
||||
if (!par1World.isSideSolid(par2 - 1, par3, par4, ForgeDirection.EAST, true) && i1 == 1) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!par1World.isSideSolid(par2 + 1, par3, par4, ForgeDirection.WEST, true) && i1 == 2) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!par1World.isSideSolid(par2, par3, par4 - 1, ForgeDirection.SOUTH, true) && i1 == 3) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!par1World.isSideSolid(par2, par3, par4 + 1, ForgeDirection.NORTH, true) && i1 == 4) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!this.canPlaceTorchOn(par1World, par2, par3 - 1, par4) && i1 == 5) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Yes, function hiding. Go away.
|
||||
public boolean canPlaceTorchOn(World par1World, int par2, int par3, int par4) {
|
||||
if (World.doesBlockHaveSolidTopSurface(par1World, par2, par3, par4)) {
|
||||
return true;
|
||||
} else {
|
||||
Block block = par1World.getBlock(par2, par3, par4);
|
||||
return block.canPlaceTorchOnTop(par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
|
||||
protected int getColourValueFromItemStack(ItemStack itemStack) {
|
||||
protected static int getColourValueFromItemStack(ItemStack itemStack) {
|
||||
int value = 0xffffff; // default to white.
|
||||
if (itemStack.hasTagCompound()) {
|
||||
NBTTagCompound tag = itemStack.getTagCompound();
|
||||
@@ -364,25 +312,17 @@ public class BlockCandle extends BlockTorch {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static boolean isLit(int meta) {
|
||||
return (meta & 0x08) > 0;
|
||||
}
|
||||
|
||||
public static boolean isLit(ItemStack itemStack) {
|
||||
return itemStack.getItemDamage() > 0;
|
||||
}
|
||||
|
||||
protected int toggleLitStatus(int meta) {
|
||||
return meta ^ 0x08;
|
||||
}
|
||||
|
||||
public void addItemToLightingList(Item item) {
|
||||
public static void addItemToLightingList(Item item) {
|
||||
if (item == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
if (!this.lightingItems.contains(item)) {
|
||||
this.lightingItems.add(item);
|
||||
if (!lightingItems.contains(item)) {
|
||||
lightingItems.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,26 +60,11 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (!Proxies.common.isSimulating(worldObj)) {
|
||||
updateClientSide();
|
||||
} else {
|
||||
// Periodic validation if needed
|
||||
if (updateOnInterval(200) && (!isIntegratedIntoStructure() || isMaster())) {
|
||||
validateStructure();
|
||||
}
|
||||
|
||||
updateServerSide();
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateServerSide() {
|
||||
}
|
||||
|
||||
protected void updateClientSide() {
|
||||
// Periodic validation if needed
|
||||
if (updateOnInterval(200) && (!isIntegratedIntoStructure() || isMaster())) {
|
||||
validateStructure();
|
||||
}
|
||||
}
|
||||
|
||||
/* TEXTURES */
|
||||
@@ -229,11 +214,6 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon
|
||||
return isMaster || masterY >= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final IInventoryAdapter getInventory() {
|
||||
return getStructureInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventoryAdapter getStructureInventory() {
|
||||
return getInternalInventory();
|
||||
|
||||
@@ -75,7 +75,7 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner
|
||||
}
|
||||
|
||||
if ((wasInactive && workingTime > 0) || (!wasInactive && workingTime == 0)) {
|
||||
sendNetworkUpdate();
|
||||
setNeedsNetworkUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,16 +69,7 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
public TileAlvearyHygroregulator() {
|
||||
super(BLOCK_META);
|
||||
|
||||
setInternalInventory(new TileInventoryAdapter(this, 1, "CanInv") {
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == SLOT_INPUT) {
|
||||
Fluid fluid = FluidHelper.getFluidInContainer(itemStack);
|
||||
return liquidTank.accepts(fluid);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
setInternalInventory(new HygroInventoryAdapter(this));
|
||||
|
||||
Fluid water = Fluids.WATER.getFluid();
|
||||
Fluid lava = Fluids.LAVA.getFluid();
|
||||
@@ -231,4 +222,19 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
@Override
|
||||
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
|
||||
}
|
||||
|
||||
private static class HygroInventoryAdapter extends TileInventoryAdapter<TileAlvearyHygroregulator> {
|
||||
public HygroInventoryAdapter(TileAlvearyHygroregulator alvearyHygroregulator) {
|
||||
super(alvearyHygroregulator, 1, "CanInv");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == SLOT_INPUT) {
|
||||
Fluid fluid = FluidHelper.getFluidInContainer(itemStack);
|
||||
return tile.liquidTank.accepts(fluid);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
@@ -51,7 +52,6 @@ import forestry.core.network.PacketIds;
|
||||
import forestry.core.network.PacketInventoryStack;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IBeeHousing, IClimatised, IHintSource {
|
||||
|
||||
@@ -91,7 +91,6 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
|
||||
private void setBiomeInformation() {
|
||||
this.biome = Utils.getBiomeAt(worldObj, xCoord, zCoord);
|
||||
setErrorState(EnumErrorCode.OK);
|
||||
}
|
||||
|
||||
/* LOADING & SAVING */
|
||||
@@ -105,7 +104,6 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
if (beekeepingLogic != null) {
|
||||
beekeepingLogic.readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -118,7 +116,6 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
if (beekeepingLogic != null) {
|
||||
beekeepingLogic.writeToNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* UPDATING */
|
||||
@@ -130,6 +127,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
|
||||
@Override
|
||||
protected void updateServerSide() {
|
||||
super.updateServerSide();
|
||||
|
||||
if (beekeepingLogic == null) {
|
||||
return;
|
||||
@@ -157,23 +155,22 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
}
|
||||
}
|
||||
|
||||
if (getErrorState() == EnumErrorCode.OK) {
|
||||
if (!hasErrorState()) {
|
||||
queen.doFX(beekeepingLogic.getEffectData(), this);
|
||||
|
||||
if (updateOnInterval(50)) {
|
||||
float f = xCoord + 0.5F;
|
||||
float f1 = yCoord + 0.0F + (worldObj.rand.nextFloat() * 6F) / 16F;
|
||||
float f2 = zCoord + 0.5F;
|
||||
float f3 = 0.52F;
|
||||
float f4 = worldObj.rand.nextFloat() * 0.6F - 0.3F;
|
||||
|
||||
Proxies.common.addEntitySwarmFX(worldObj, (f - f3), f1, (f2 + f4), 0F, 0F, 0F);
|
||||
Proxies.common.addEntitySwarmFX(worldObj, (f + f3), f1, (f2 + f4), 0F, 0F, 0F);
|
||||
Proxies.common.addEntitySwarmFX(worldObj, (f + f4), f1, (f2 - f3), 0F, 0F, 0F);
|
||||
Proxies.common.addEntitySwarmFX(worldObj, (f + f4), f1, (f2 + f3), 0F, 0F, 0F);
|
||||
}
|
||||
}
|
||||
|
||||
if (getErrorState() == EnumErrorCode.OK && updateOnInterval(50)) {
|
||||
float f = xCoord + 0.5F;
|
||||
float f1 = yCoord + 0.0F + (worldObj.rand.nextFloat() * 6F) / 16F;
|
||||
float f2 = zCoord + 0.5F;
|
||||
float f3 = 0.52F;
|
||||
float f4 = worldObj.rand.nextFloat() * 0.6F - 0.3F;
|
||||
|
||||
Proxies.common.addEntitySwarmFX(worldObj, (f - f3), f1, (f2 + f4), 0F, 0F, 0F);
|
||||
Proxies.common.addEntitySwarmFX(worldObj, (f + f3), f1, (f2 + f4), 0F, 0F, 0F);
|
||||
Proxies.common.addEntitySwarmFX(worldObj, (f + f4), f1, (f2 - f3), 0F, 0F, 0F);
|
||||
Proxies.common.addEntitySwarmFX(worldObj, (f + f4), f1, (f2 + f3), 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -183,16 +180,20 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
return;
|
||||
}
|
||||
|
||||
ISidedInventory inventory = getStructureInventory();
|
||||
if (inventory == null) {
|
||||
if (hasErrorState()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// / Multiplayer FX
|
||||
ItemStack queenStack = inventory.getStackInSlot(SLOT_QUEEN);
|
||||
if (PluginApiculture.beeInterface.isMated(queenStack)) {
|
||||
if (getErrorState() == EnumErrorCode.OK && updateOnInterval(2)) {
|
||||
IBee displayQueen = PluginApiculture.beeInterface.getMember(queenStack);
|
||||
if (updateOnInterval(2)) {
|
||||
ISidedInventory inventory = getStructureInventory();
|
||||
if (inventory == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// / Multiplayer FX
|
||||
ItemStack queenStack = inventory.getStackInSlot(SLOT_QUEEN);
|
||||
if (BeeManager.beeRoot.isMated(queenStack)) {
|
||||
IBee displayQueen = BeeManager.beeRoot.getMember(queenStack);
|
||||
displayQueen.doFX(beekeepingLogic.getEffectData(), this);
|
||||
}
|
||||
}
|
||||
@@ -227,9 +228,9 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (PluginApiculture.beeInterface.isMated(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
return PluginApiculture.beeInterface.getMember(inventory.getStackInSlot(SLOT_QUEEN)).getHealth();
|
||||
} else if (!PluginApiculture.beeInterface.isDrone(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
if (BeeManager.beeRoot.isMated(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
return BeeManager.beeRoot.getMember(inventory.getStackInSlot(SLOT_QUEEN)).getHealth();
|
||||
} else if (!BeeManager.beeRoot.isDrone(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
return displayHealth;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -242,9 +243,9 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (PluginApiculture.beeInterface.isMated(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
return PluginApiculture.beeInterface.getMember(inventory.getStackInSlot(SLOT_QUEEN)).getMaxHealth();
|
||||
} else if (!PluginApiculture.beeInterface.isDrone(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
if (BeeManager.beeRoot.isMated(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
return BeeManager.beeRoot.getMember(inventory.getStackInSlot(SLOT_QUEEN)).getMaxHealth();
|
||||
} else if (!BeeManager.beeRoot.isDrone(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
return displayHealthMax;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -262,29 +263,14 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
/* STRUCTURE MANAGMENT */
|
||||
@Override
|
||||
protected void createInventory() {
|
||||
setInternalInventory(new TileInventoryAdapter(this, 9, "Items") {
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == SLOT_QUEEN) {
|
||||
return PluginApiculture.beeInterface.isMember(itemStack) && !PluginApiculture.beeInterface.isDrone(itemStack);
|
||||
} else if (slotIndex == SLOT_DRONE) {
|
||||
return PluginApiculture.beeInterface.isDrone(itemStack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
return slotIndex != SLOT_QUEEN && slotIndex != SLOT_DRONE;
|
||||
}
|
||||
});
|
||||
setInternalInventory(new AlvearyInventoryAdapter(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void makeMaster() {
|
||||
super.makeMaster();
|
||||
if (beekeepingLogic == null) {
|
||||
this.beekeepingLogic = PluginApiculture.beeInterface.createBeekeepingLogic(this);
|
||||
this.beekeepingLogic = BeeManager.beeRoot.createBeekeepingLogic(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,11 +353,6 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
setInventorySlotContents(SLOT_DRONE, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBiomeId() {
|
||||
return biome.biomeID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeGenBase getBiome() {
|
||||
return biome;
|
||||
@@ -450,16 +431,6 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorState(int state) {
|
||||
setErrorState(EnumErrorCode.values()[state]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getErrorOrdinal() {
|
||||
return getErrorState().getID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBreed() {
|
||||
return true;
|
||||
@@ -475,6 +446,15 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
return InvTools.tryAddStack(inventory, product, SLOT_PRODUCT_1, inventory.getSizeInventory() - SLOT_PRODUCT_1, all);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void setErrorState(IErrorState state) {
|
||||
removeErrorStates();
|
||||
if (state != EnumErrorCode.OK) {
|
||||
addErrorState(state);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wearOutEquipment(int amount) {
|
||||
for (IBeeListener eventHandler : eventHandlers) {
|
||||
@@ -624,16 +604,26 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
}
|
||||
|
||||
/* IERRORSOURCE */
|
||||
@Deprecated
|
||||
@Override
|
||||
public IErrorState getErrorState() {
|
||||
Set<IErrorState> errorStates = null;
|
||||
if (hasMaster()) {
|
||||
ITileStructure tile = this.getCentralTE();
|
||||
ITileStructure tile = getCentralTE();
|
||||
if (tile != null) {
|
||||
return ((IErrorSource) tile).getErrorState();
|
||||
errorStates = ((IErrorSource) tile).getErrorStates();
|
||||
}
|
||||
}
|
||||
|
||||
return errorState;
|
||||
if (errorStates == null) {
|
||||
errorStates = this.getErrorStates();
|
||||
}
|
||||
|
||||
if (errorStates.size() == 0) {
|
||||
return EnumErrorCode.OK;
|
||||
} else {
|
||||
return getErrorStates().iterator().next();
|
||||
}
|
||||
}
|
||||
|
||||
/* ICLIMATISED */
|
||||
@@ -674,4 +664,25 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
public GameProfile getOwnerName() {
|
||||
return this.getOwnerProfile();
|
||||
}
|
||||
|
||||
private static class AlvearyInventoryAdapter extends TileInventoryAdapter<TileAlvearyPlain> {
|
||||
public AlvearyInventoryAdapter(TileAlvearyPlain tileAlvearyPlain) {
|
||||
super(tileAlvearyPlain, 9, "Items");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == SLOT_QUEEN) {
|
||||
return BeeManager.beeRoot.isMember(itemStack) && !BeeManager.beeRoot.isDrone(itemStack);
|
||||
} else if (slotIndex == SLOT_DRONE) {
|
||||
return BeeManager.beeRoot.isDrone(itemStack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
return slotIndex != SLOT_QUEEN && slotIndex != SLOT_DRONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,12 +39,7 @@ public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListe
|
||||
|
||||
public TileAlvearySieve() {
|
||||
super(BLOCK_META);
|
||||
setInternalInventory(new TileInventoryAdapter(this, 5, "Items", 1) {
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
return StackUtils.isIdenticalItem(ForestryItem.craftingMaterial.getItemStack(1, 3), itemStack);
|
||||
}
|
||||
});
|
||||
setInternalInventory(new AlvearySieveInventoryAdapter(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -187,4 +182,15 @@ public class TileAlvearySieve extends TileAlveary implements ICrafter, IBeeListe
|
||||
public boolean onEggLaid(IBee queen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class AlvearySieveInventoryAdapter extends TileInventoryAdapter<TileAlvearySieve> {
|
||||
public AlvearySieveInventoryAdapter(TileAlvearySieve alvearySieve) {
|
||||
super(alvearySieve, 5, "Items", 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
return StackUtils.isIdenticalItem(ForestryItem.craftingMaterial.getItemStack(1, 3), itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ import forestry.core.inventory.wrappers.InventoryIterator;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory {
|
||||
|
||||
@@ -46,12 +45,7 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory {
|
||||
|
||||
public TileAlvearySwarmer() {
|
||||
super(BLOCK_META);
|
||||
setInternalInventory(new TileInventoryAdapter(this, 4, "SwarmInv") {
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
return StackUtils.containsItemStack(BeeManager.inducers.keySet(), itemStack);
|
||||
}
|
||||
});
|
||||
setInternalInventory(new SwarmerInventoryAdapter(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,9 +87,9 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory {
|
||||
}
|
||||
|
||||
// Queue swarm spawn
|
||||
IBee princess = PluginApiculture.beeInterface.getMember(princessStack);
|
||||
IBee princess = BeeManager.beeRoot.getMember(princessStack);
|
||||
princess.setIsNatural(false);
|
||||
pendingSpawns.push(PluginApiculture.beeInterface.getMemberStack(princess, EnumBeeType.PRINCESS.ordinal()));
|
||||
pendingSpawns.push(BeeManager.beeRoot.getMemberStack(princess, EnumBeeType.PRINCESS.ordinal()));
|
||||
}
|
||||
|
||||
private ItemStack getPrincessStack() {
|
||||
@@ -110,7 +104,7 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory {
|
||||
|
||||
IBeeHousing housing = (IBeeHousing) master;
|
||||
ItemStack princessStack = housing.getQueen();
|
||||
if (princessStack == null || !PluginApiculture.beeInterface.isMated(princessStack)) {
|
||||
if (princessStack == null || !BeeManager.beeRoot.isMated(princessStack)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -152,7 +146,7 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory {
|
||||
private void setIsActive(boolean isActive) {
|
||||
if (this.isActive != isActive) {
|
||||
this.isActive = isActive;
|
||||
sendNetworkUpdate();
|
||||
setNeedsNetworkUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,4 +216,15 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory {
|
||||
nbttagcompound.setTag("PendingSpawns", nbttaglist);
|
||||
|
||||
}
|
||||
|
||||
private static class SwarmerInventoryAdapter extends TileInventoryAdapter<TileAlvearySwarmer> {
|
||||
public SwarmerInventoryAdapter(TileAlvearySwarmer alvearySwarmer) {
|
||||
super(alvearySwarmer, 4, "SwarmInv");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
return StackUtils.containsItemStack(BeeManager.inducers.keySet(), itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,15 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.apiculture.genetics.BeeHelper;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.core.gadgets.TileNaturalistChest;
|
||||
import forestry.core.network.GuiId;
|
||||
|
||||
public class TileApiaristChest extends TileNaturalistChest {
|
||||
|
||||
public TileApiaristChest() {
|
||||
super(AlleleManager.alleleRegistry.getSpeciesRoot(BeeHelper.UID), GuiId.ApiaristChestGUI.ordinal());
|
||||
super(BeeManager.beeRoot, GuiId.ApiaristChestGUI.ordinal());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
@@ -27,7 +28,6 @@ import forestry.apiculture.trigger.ApicultureTriggers;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
|
||||
@@ -136,7 +136,7 @@ public class TileApiary extends TileBeehouse {
|
||||
@Override
|
||||
public void wearOutEquipment(int amount) {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
int wear = Math.round(amount * PluginApiculture.beeInterface.getBeekeepingMode(worldObj).getWearModifier());
|
||||
int wear = Math.round(amount * BeeManager.beeRoot.getBeekeepingMode(worldObj).getWearModifier());
|
||||
|
||||
for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
|
||||
if (inventory.getStackInSlot(i) == null) {
|
||||
@@ -149,7 +149,7 @@ public class TileApiary extends TileBeehouse {
|
||||
inventory.setInventorySlotContents(
|
||||
i,
|
||||
((IHiveFrame) inventory.getStackInSlot(i).getItem()).frameUsed(this, inventory.getStackInSlot(i),
|
||||
PluginApiculture.beeInterface.getMember(inventory.getStackInSlot(SLOT_QUEEN)), wear));
|
||||
BeeManager.beeRoot.getMember(inventory.getStackInSlot(SLOT_QUEEN)), wear));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
@@ -20,6 +22,7 @@ import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
@@ -28,6 +31,7 @@ import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
@@ -45,41 +49,14 @@ import forestry.core.network.PacketTileUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.GuiUtil;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
|
||||
protected static class BeehouseInventoryAdapter extends TileInventoryAdapter {
|
||||
public BeehouseInventoryAdapter(TileForestry tile, int size, String name) {
|
||||
super(tile, size, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == SLOT_QUEEN) {
|
||||
return PluginApiculture.beeInterface.isMember(itemStack) && !PluginApiculture.beeInterface.isDrone(itemStack);
|
||||
} else if (GuiUtil.isIndexInRange(slotIndex, SLOT_FRAMES_1, SLOT_FRAMES_COUNT)) {
|
||||
return itemStack.getItem() instanceof IHiveFrame;
|
||||
} else if (slotIndex == SLOT_DRONE) {
|
||||
return PluginApiculture.beeInterface.isDrone(itemStack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
return GuiUtil.isIndexInRange(slotIndex, SLOT_PRODUCT_1, SLOT_PRODUCT_COUNT);
|
||||
}
|
||||
}
|
||||
|
||||
// CONSTANTS
|
||||
public static final int SLOT_QUEEN = 0;
|
||||
public static final int SLOT_DRONE = 1;
|
||||
public static final int SLOT_PRODUCT_1 = 2;
|
||||
public static final int SLOT_PRODUCT_COUNT = 7;
|
||||
public static final int SLOT_FRAMES_1 = 9;
|
||||
public static final int SLOT_FRAMES_2 = 10;
|
||||
public static final int SLOT_FRAMES_3 = 11;
|
||||
public static final int SLOT_FRAMES_COUNT = 3;
|
||||
private final IBeekeepingLogic logic;
|
||||
private BiomeGenBase biome;
|
||||
@@ -88,7 +65,7 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
|
||||
public TileBeehouse() {
|
||||
setHints(Config.hints.get("apiary"));
|
||||
logic = PluginApiculture.beeInterface.createBeekeepingLogic(this);
|
||||
logic = BeeManager.beeRoot.createBeekeepingLogic(this);
|
||||
setInternalInventory(new BeehouseInventoryAdapter(this, 12, "Items").disableAutomation());
|
||||
}
|
||||
|
||||
@@ -145,6 +122,26 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
return EnumHumidity.getFromValue(getExactHumidity());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void setErrorState(IErrorState state) {
|
||||
removeErrorStates();
|
||||
if (state != EnumErrorCode.OK) {
|
||||
addErrorState(state);
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public IErrorState getErrorState() {
|
||||
Set<IErrorState> errorStates = getErrorStates();
|
||||
if (errorStates.size() == 0) {
|
||||
return EnumErrorCode.OK;
|
||||
} else {
|
||||
return getErrorStates().iterator().next();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExactTemperature() {
|
||||
return biome.temperature;
|
||||
@@ -160,9 +157,9 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
public void updateClientSide() {
|
||||
|
||||
// / Multiplayer FX
|
||||
if (PluginApiculture.beeInterface.isMated(getInternalInventory().getStackInSlot(SLOT_QUEEN))) {
|
||||
if (getErrorState() == EnumErrorCode.OK && updateOnInterval(2)) {
|
||||
IBee displayQueen = PluginApiculture.beeInterface.getMember(getInternalInventory().getStackInSlot(SLOT_QUEEN));
|
||||
if (BeeManager.beeRoot.isMated(getInternalInventory().getStackInSlot(SLOT_QUEEN))) {
|
||||
if (!hasErrorState() && updateOnInterval(2)) {
|
||||
IBee displayQueen = BeeManager.beeRoot.getMember(getInternalInventory().getStackInSlot(SLOT_QUEEN));
|
||||
displayQueen.doFX(logic.getEffectData(), this);
|
||||
}
|
||||
}
|
||||
@@ -187,7 +184,7 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
|
||||
// @Override
|
||||
public boolean isWorking() {
|
||||
return getErrorState() == EnumErrorCode.OK;
|
||||
return !hasErrorState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -215,7 +212,7 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
}
|
||||
|
||||
if (ForestryItem.beeQueenGE.isItemEqual(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
return PluginApiculture.beeInterface.getMember(inventory.getStackInSlot(SLOT_QUEEN)).getHealth();
|
||||
return BeeManager.beeRoot.getMember(inventory.getStackInSlot(SLOT_QUEEN)).getHealth();
|
||||
} else if (ForestryItem.beePrincessGE.isItemEqual(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
return displayHealth;
|
||||
} else {
|
||||
@@ -230,7 +227,7 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
}
|
||||
|
||||
if (ForestryItem.beeQueenGE.isItemEqual(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
return PluginApiculture.beeInterface.getMember(inventory.getStackInSlot(SLOT_QUEEN)).getMaxHealth();
|
||||
return BeeManager.beeRoot.getMember(inventory.getStackInSlot(SLOT_QUEEN)).getMaxHealth();
|
||||
} else if (ForestryItem.beePrincessGE.isItemEqual(inventory.getStackInSlot(SLOT_QUEEN))) {
|
||||
return displayHealthMax;
|
||||
} else {
|
||||
@@ -249,20 +246,11 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
return (getHealthDisplay() * i) / getMaxHealthDisplay();
|
||||
}
|
||||
|
||||
public int getTemperatureScaled(int i) {
|
||||
return Math.round(i * (getExactTemperature() / 2));
|
||||
}
|
||||
|
||||
public int getHumidityScaled(int i) {
|
||||
return Math.round(i * getExactHumidity());
|
||||
}
|
||||
|
||||
public void updateBiome() {
|
||||
if (worldObj != null) {
|
||||
BiomeGenBase biome = Utils.getBiomeAt(worldObj, xCoord, zCoord);
|
||||
if (biome != null) {
|
||||
this.biome = biome;
|
||||
setErrorState(EnumErrorCode.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,11 +298,6 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
return zCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBiomeId() {
|
||||
return biome.biomeID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeGenBase getBiome() {
|
||||
return biome;
|
||||
@@ -345,16 +328,6 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorState(int state) {
|
||||
setErrorState(EnumErrorCode.values()[state]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getErrorOrdinal() {
|
||||
return getErrorState().getID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBreed() {
|
||||
return true;
|
||||
@@ -437,4 +410,27 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
|
||||
public GameProfile getOwnerName() {
|
||||
return this.getOwnerProfile();
|
||||
}
|
||||
|
||||
protected static class BeehouseInventoryAdapter extends TileInventoryAdapter<TileBeehouse> {
|
||||
public BeehouseInventoryAdapter(TileBeehouse tile, int size, String name) {
|
||||
super(tile, size, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == SLOT_QUEEN) {
|
||||
return BeeManager.beeRoot.isMember(itemStack) && !BeeManager.beeRoot.isDrone(itemStack);
|
||||
} else if (GuiUtil.isIndexInRange(slotIndex, SLOT_FRAMES_1, SLOT_FRAMES_COUNT)) {
|
||||
return itemStack.getItem() instanceof IHiveFrame;
|
||||
} else if (slotIndex == SLOT_DRONE) {
|
||||
return BeeManager.beeRoot.isDrone(itemStack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemstack, int side) {
|
||||
return GuiUtil.isIndexInRange(slotIndex, SLOT_PRODUCT_1, SLOT_PRODUCT_COUNT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,14 @@
|
||||
package forestry.apiculture.gadgets;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import forestry.apiculture.network.PacketUpdateCandle;
|
||||
|
||||
public class TileCandle extends TileEntity {
|
||||
private int colour;
|
||||
private boolean lit;
|
||||
|
||||
// This is a non-ticking Tile Entity.
|
||||
@Override
|
||||
@@ -27,48 +28,49 @@ public class TileCandle extends TileEntity {
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
writeToNBT(nbt);
|
||||
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbt);
|
||||
PacketUpdateCandle updateCandle = new PacketUpdateCandle(this);
|
||||
return updateCandle.getPacket();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
public void onPacketUpdate(PacketUpdateCandle updateCandle) {
|
||||
colour = updateCandle.getColour();
|
||||
lit = updateCandle.isLit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagRoot) {
|
||||
super.readFromNBT(tagRoot);
|
||||
this.setColour(tagRoot.getInteger("colour"));
|
||||
colour = tagRoot.getInteger("colour");
|
||||
lit = tagRoot.getBoolean("lit");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagRoot) {
|
||||
super.writeToNBT(tagRoot);
|
||||
tagRoot.setInteger("colour", this.colour);
|
||||
tagRoot.setBoolean("lit", this.lit);
|
||||
}
|
||||
|
||||
public boolean isLit() {
|
||||
return lit;
|
||||
}
|
||||
|
||||
public void setLit(boolean lit) {
|
||||
this.lit = lit;
|
||||
}
|
||||
|
||||
public int getColour() {
|
||||
return this.colour;
|
||||
return colour;
|
||||
}
|
||||
|
||||
public void setColour(int value) {
|
||||
this.colour = value;
|
||||
}
|
||||
|
||||
public void setColour(int red, int green, int blue) {
|
||||
this.colour = toIntColour(red, green, blue);
|
||||
}
|
||||
|
||||
/*public void setColour(int[] cs) {
|
||||
this.colour = toIntColour(cs[0], cs[1], cs[2]);
|
||||
}*/
|
||||
|
||||
public void addColour(int red, int green, int blue) {
|
||||
public void addColour(int colour2) {
|
||||
int[] myColour = fromIntColour(this.colour);
|
||||
this.colour = toIntColour((red + myColour[0]) / 2, (green + myColour[0]) / 2, (blue + myColour[2]) / 2);
|
||||
int[] addColour = fromIntColour(colour2);
|
||||
this.colour = toIntColour((addColour[0] + myColour[0]) / 2, (addColour[0] + myColour[0]) / 2, (addColour[2] + myColour[2]) / 2);
|
||||
}
|
||||
|
||||
private static int[] fromIntColour(int value) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -25,85 +26,102 @@ import com.mojang.authlib.GameProfile;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IAlleleBeeSpeciesCustom;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeIconProvider;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.apiculture.IJubilanceProvider;
|
||||
import forestry.api.core.IIconProvider;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.genetics.AlleleSpecies;
|
||||
import forestry.core.genetics.alleles.AlleleSpecies;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.StackUtils;
|
||||
|
||||
public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies, IIconProvider {
|
||||
public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpeciesCustom {
|
||||
|
||||
public IJubilanceProvider jubilanceProvider;
|
||||
@Deprecated
|
||||
private final Map<ItemStack, Integer> products = new HashMap<ItemStack, Integer>();
|
||||
@Deprecated
|
||||
private final Map<ItemStack, Integer> specialty = new HashMap<ItemStack, Integer>();
|
||||
|
||||
private final IBeeRoot root;
|
||||
private final Map<ItemStack, Float> productChances = new HashMap<ItemStack, Float>();
|
||||
private final Map<ItemStack, Float> specialtyChances = new HashMap<ItemStack, Float>();
|
||||
|
||||
private final HashMap<ItemStack, Integer> products = new HashMap<ItemStack, Integer>();
|
||||
private final HashMap<ItemStack, Integer> specialty = new HashMap<ItemStack, Integer>();
|
||||
|
||||
private String texture;
|
||||
private final int primaryColour;
|
||||
private final int secondaryColour;
|
||||
|
||||
private static final String iconType = "default";
|
||||
private IBeeIconProvider beeIconProvider;
|
||||
private IJubilanceProvider jubilanceProvider;
|
||||
private boolean nocturnal = false;
|
||||
|
||||
public AlleleBeeSpecies(String uid, boolean dominant, String name, IClassification branch, int primaryColor, int secondaryColor) {
|
||||
this(uid, dominant, name, branch, null, primaryColor, secondaryColor);
|
||||
}
|
||||
public AlleleBeeSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, int primaryColor, int secondaryColor) {
|
||||
super(uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, false);
|
||||
|
||||
public AlleleBeeSpecies(String uid, boolean dominant, String name, IClassification branch, String binomial, int primaryColor, int secondaryColor) {
|
||||
this(uid, dominant, name, branch, binomial, primaryColor, secondaryColor, new JubilanceDefault());
|
||||
}
|
||||
|
||||
public AlleleBeeSpecies(String uid, boolean dominant, String name, IClassification branch, String binomial, int primaryColor, int secondaryColor,
|
||||
IJubilanceProvider jubilanceProvider) {
|
||||
super(uid, dominant, name, branch, binomial);
|
||||
|
||||
this.root = (IBeeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
|
||||
this.primaryColour = primaryColor;
|
||||
this.secondaryColour = secondaryColor;
|
||||
this.jubilanceProvider = jubilanceProvider;
|
||||
texture = Defaults.TEXTURE_PATH_ENTITIES + "/bees/honeyBee.png";
|
||||
|
||||
setCustomBeeIconProvider(DefaultBeeIconProvider.getInstance());
|
||||
setJubilanceProvider(JubilanceDefault.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeRoot getRoot() {
|
||||
return root;
|
||||
return BeeManager.beeRoot;
|
||||
}
|
||||
|
||||
public AlleleBeeSpecies setEntityTexture(String texture) {
|
||||
this.texture = Defaults.TEXTURE_PATH_ENTITIES + "/bees/" + texture + ".png";
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlleleBeeSpecies addProduct(ItemStack product, int chance) {
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom addProduct(ItemStack product, Float chance) {
|
||||
if (product == null || product.getItem() == null) {
|
||||
throw new IllegalArgumentException("Tried to add null product");
|
||||
}
|
||||
this.products.put(product, chance);
|
||||
if (chance <= 0.0f || chance > 1.0f) {
|
||||
throw new IllegalArgumentException("chance must be in the range (0, 1]");
|
||||
}
|
||||
this.productChances.put(product, chance);
|
||||
int intChance = Math.max(1, Math.round(chance * 100));
|
||||
this.products.put(product, intChance);
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlleleBeeSpecies addSpecialty(ItemStack specialty, int chance) {
|
||||
this.specialty.put(specialty, chance);
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom addSpecialty(ItemStack specialty, Float chance) {
|
||||
if (specialty == null || specialty.getItem() == null) {
|
||||
throw new IllegalArgumentException("Tried to add null specialty");
|
||||
}
|
||||
if (chance <= 0.0f || chance > 1.0f) {
|
||||
throw new IllegalArgumentException("chance must be in the range (0, 1]");
|
||||
}
|
||||
this.specialtyChances.put(specialty, chance);
|
||||
int intChance = Math.max(1, Math.round(chance * 100));
|
||||
this.specialty.put(specialty, intChance);
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlleleBeeSpecies setJubilanceProvider(IJubilanceProvider provider) {
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom setJubilanceProvider(IJubilanceProvider provider) {
|
||||
this.jubilanceProvider = provider;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom setNocturnal() {
|
||||
nocturnal = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom setCustomBeeIconProvider(IBeeIconProvider beeIconProvider) {
|
||||
this.beeIconProvider = beeIconProvider;
|
||||
return this;
|
||||
}
|
||||
|
||||
/* RESEARCH */
|
||||
@Override
|
||||
public int getComplexity() {
|
||||
@@ -140,12 +158,12 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
return 0f;
|
||||
}
|
||||
|
||||
for (ItemStack stack : products.keySet()) {
|
||||
for (ItemStack stack : productChances.keySet()) {
|
||||
if (stack.isItemEqual(itemstack)) {
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
for (ItemStack stack : specialty.keySet()) {
|
||||
for (ItemStack stack : specialtyChances.keySet()) {
|
||||
if (stack.isItemEqual(itemstack)) {
|
||||
return 1.0f;
|
||||
}
|
||||
@@ -160,11 +178,11 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
Collections.addAll(bounty, super.getResearchBounty(world, researcher, individual, bountyLevel));
|
||||
|
||||
if (bountyLevel > 10) {
|
||||
for (ItemStack stack : specialty.keySet()) {
|
||||
for (ItemStack stack : specialtyChances.keySet()) {
|
||||
bounty.add(StackUtils.copyWithRandomSize(stack, (int) ((float) bountyLevel / 2), world.rand));
|
||||
}
|
||||
}
|
||||
for (ItemStack stack : products.keySet()) {
|
||||
for (ItemStack stack : productChances.keySet()) {
|
||||
bounty.add(StackUtils.copyWithRandomSize(stack, (int) ((float) bountyLevel / 2), world.rand));
|
||||
}
|
||||
return bounty.toArray(new ItemStack[bounty.size()]);
|
||||
@@ -173,27 +191,43 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
/* OTHER */
|
||||
@Override
|
||||
public boolean isNocturnal() {
|
||||
return false;
|
||||
return nocturnal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<ItemStack, Integer> getProducts() {
|
||||
public Map<ItemStack, Integer> getProducts() {
|
||||
return products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<ItemStack, Integer> getSpecialty() {
|
||||
public Map<ItemStack, Float> getProductChances() {
|
||||
return productChances;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ItemStack, Integer> getSpecialty() {
|
||||
return specialty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ItemStack, Float> getSpecialtyChances() {
|
||||
return specialtyChances;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isJubilant(IBeeGenome genome, IBeeHousing housing) {
|
||||
return jubilanceProvider.isJubilant(this, genome, housing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTexture() {
|
||||
return texture;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIconProvider getIconProvider() {
|
||||
return new BeeIconProviderWrapper(beeIconProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(EnumBeeType type, int renderPass) {
|
||||
return beeIconProvider.getIcon(type, renderPass);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -207,45 +241,69 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon[][] icons;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
icons = new IIcon[EnumBeeType.values().length][3];
|
||||
|
||||
IIcon body1 = TextureManager.getInstance().registerTex(register, "bees/" + iconType + "/body1");
|
||||
|
||||
for (int i = 0; i < EnumBeeType.values().length; i++) {
|
||||
if (EnumBeeType.values()[i] == EnumBeeType.NONE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
icons[i][0] = TextureManager.getInstance().registerTex(register, "bees/" + iconType + "/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".outline");
|
||||
icons[i][1] = (EnumBeeType.values()[i] != EnumBeeType.LARVAE) ? body1
|
||||
: TextureManager.getInstance().registerTex(register, "bees/" + iconType + "/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".body");
|
||||
icons[i][2] = TextureManager.getInstance().registerTex(register, "bees/" + iconType + "/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".body2");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(EnumBeeType type, int renderPass) {
|
||||
return icons[type.ordinal()][renderPass];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIconProvider getIconProvider() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(short texUID) {
|
||||
public String getEntityTexture() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class DefaultBeeIconProvider implements IBeeIconProvider {
|
||||
|
||||
private static final String iconType = "default";
|
||||
private static DefaultBeeIconProvider instance;
|
||||
|
||||
public static DefaultBeeIconProvider getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new DefaultBeeIconProvider();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private DefaultBeeIconProvider() {
|
||||
|
||||
}
|
||||
|
||||
private static final IIcon[][] icons = new IIcon[EnumBeeType.values().length][3];
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
IIcon body1 = TextureManager.getInstance().registerTex(register, "bees/" + iconType + "/body1");
|
||||
|
||||
for (int i = 0; i < EnumBeeType.values().length; i++) {
|
||||
if (EnumBeeType.values()[i] == EnumBeeType.NONE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
icons[i][0] = TextureManager.getInstance().registerTex(register, "bees/" + iconType + '/' + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".outline");
|
||||
icons[i][1] = (EnumBeeType.values()[i] != EnumBeeType.LARVAE) ? body1
|
||||
: TextureManager.getInstance().registerTex(register, "bees/" + iconType + '/' + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".body");
|
||||
icons[i][2] = TextureManager.getInstance().registerTex(register, "bees/" + iconType + '/' + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".body2");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(EnumBeeType type, int renderPass) {
|
||||
return icons[type.ordinal()][renderPass];
|
||||
}
|
||||
}
|
||||
|
||||
private static class BeeIconProviderWrapper implements IIconProvider {
|
||||
|
||||
private final IBeeIconProvider beeIconProvider;
|
||||
|
||||
public BeeIconProviderWrapper(IBeeIconProvider beeIconProvider) {
|
||||
this.beeIconProvider = beeIconProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(short texUID) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
beeIconProvider.registerIcons(register);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,8 +27,8 @@ public class AlleleEffectAggressive extends AlleleEffectThrottled {
|
||||
|
||||
public static final DamageSource damageSourceBeeAggressive = new DamageSourceForestry("bee.aggressive");
|
||||
|
||||
public AlleleEffectAggressive(String uid) {
|
||||
super(uid, "aggressive", true, 40, false, false);
|
||||
public AlleleEffectAggressive() {
|
||||
super("aggressive", true, 40, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,8 +29,8 @@ public class AlleleEffectCreeper extends AlleleEffectThrottled {
|
||||
private final byte indexExplosionTimer = 1;
|
||||
private final byte indexExplosionForce = 2;
|
||||
|
||||
public AlleleEffectCreeper(String uid) {
|
||||
super(uid, "creeper", true, 20, false, true);
|
||||
public AlleleEffectCreeper() {
|
||||
super("creeper", true, 20, false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,8 +21,8 @@ import forestry.api.genetics.IEffectData;
|
||||
|
||||
public class AlleleEffectExploration extends AlleleEffectThrottled {
|
||||
|
||||
public AlleleEffectExploration(String uid) {
|
||||
super(uid, "exploration", false, 80, true, false);
|
||||
public AlleleEffectExploration() {
|
||||
super("exploration", false, 80, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,8 +13,8 @@ public class AlleleEffectFertile extends AlleleEffectThrottled {
|
||||
|
||||
public static final int MAX_BLOCK_FIND_TRIES = 5;
|
||||
|
||||
public AlleleEffectFertile(String uid) {
|
||||
super(uid, "fertile", false, 6, true, false);
|
||||
public AlleleEffectFertile() {
|
||||
super("fertile", false, 6, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,8 +21,8 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
|
||||
public static final int MAX_BLOCK_FIND_TRIES = 10;
|
||||
public static final int ENTITY_THROTTLE = 6;
|
||||
|
||||
public AlleleEffectFungification(String uid) {
|
||||
super(uid, "mycophilic", true, 10, false, false);
|
||||
public AlleleEffectFungification() {
|
||||
super("mycophilic", true, 10, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,8 +24,8 @@ import forestry.core.vect.Vect;
|
||||
|
||||
public class AlleleEffectGlacial extends AlleleEffectThrottled {
|
||||
|
||||
public AlleleEffectGlacial(String uid) {
|
||||
super(uid, "glacial", false, 200, true, false);
|
||||
public AlleleEffectGlacial() {
|
||||
super("glacial", false, 200, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,7 +37,8 @@ public class AlleleEffectGlacial extends AlleleEffectThrottled {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
EnumTemperature temp = EnumTemperature.getFromValue(BiomeGenBase.getBiome(housing.getBiomeId()).temperature);
|
||||
BiomeGenBase biome = housing.getBiome();
|
||||
EnumTemperature temp = EnumTemperature.getFromBiome(biome);
|
||||
|
||||
switch (temp) {
|
||||
case HELLISH:
|
||||
|
||||
@@ -22,8 +22,8 @@ import forestry.api.genetics.IEffectData;
|
||||
|
||||
public class AlleleEffectHeroic extends AlleleEffectThrottled {
|
||||
|
||||
public AlleleEffectHeroic(String uid) {
|
||||
super(uid, "heroic", false, 40, true, false);
|
||||
public AlleleEffectHeroic() {
|
||||
super("heroic", false, 40, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,8 +28,8 @@ public class AlleleEffectIgnition extends AlleleEffectThrottled {
|
||||
private static final int ignitionChance = 50;
|
||||
private static final int fireDuration = 500;
|
||||
|
||||
public AlleleEffectIgnition(String uid) {
|
||||
super(uid, "ignition", false, 20, false, true);
|
||||
public AlleleEffectIgnition() {
|
||||
super("ignition", false, 20, false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,8 +28,8 @@ public class AlleleEffectMiasmic extends AlleleEffectThrottled {
|
||||
|
||||
private static final int infectionChance = 50;
|
||||
|
||||
public AlleleEffectMiasmic(String uid) {
|
||||
super(uid, "misasmic", false, 50, false, false);
|
||||
public AlleleEffectMiasmic() {
|
||||
super("miasmic", false, 50, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,8 +26,8 @@ public class AlleleEffectMisanthrope extends AlleleEffectThrottled {
|
||||
|
||||
public static final DamageSource damageSourceBeeEnd = new DamageSourceForestry("bee.end");
|
||||
|
||||
public AlleleEffectMisanthrope(String uid) {
|
||||
super(uid, "misanthrope", true, 20, false, false);
|
||||
public AlleleEffectMisanthrope() {
|
||||
super("misanthrope", true, 20, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,19 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.alleles.AlleleCategorized;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class AlleleEffectNone extends Allele implements IAlleleBeeEffect {
|
||||
public class AlleleEffectNone extends AlleleCategorized implements IAlleleBeeEffect {
|
||||
|
||||
public AlleleEffectNone(String uid) {
|
||||
super(uid, true);
|
||||
public AlleleEffectNone(String name) {
|
||||
super("forestry", "effect", name, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,18 +35,9 @@ public class AlleleEffectNone extends Allele implements IAlleleBeeEffect {
|
||||
|
||||
@Override
|
||||
public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
return doEffect(genome, storedData, housing.getWorld(), housing.getBiomeId(), housing.getXCoord(), housing.getYCoord(), housing.getZCoord());
|
||||
}
|
||||
|
||||
protected IEffectData doEffect(IBeeGenome genome, IEffectData storedData, World world, int biomeid, int x, int y, int z) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "apiculture.effect.none";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ public class AlleleEffectPotion extends AlleleEffectThrottled {
|
||||
private final boolean isBadEffect;
|
||||
private final int duration;
|
||||
|
||||
public AlleleEffectPotion(String uid, String name, boolean isDominant, Potion potion, int duration, boolean requiresWorking) {
|
||||
super(uid, name, isDominant, 200, requiresWorking, false);
|
||||
public AlleleEffectPotion(String name, boolean isDominant, Potion potion, int duration, boolean requiresWorking) {
|
||||
super(name, isDominant, 200, requiresWorking, false);
|
||||
this.potion = potion;
|
||||
this.isBadEffect = isBadEffect(potion);
|
||||
this.duration = duration;
|
||||
|
||||
@@ -34,8 +34,8 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
|
||||
public static final DamageSource damageSourceBeeRadioactive = new DamageSourceForestry("bee.radioactive");
|
||||
|
||||
public AlleleEffectRadioactive(String uid) {
|
||||
super(uid, "radioactive", true, 40, false, true);
|
||||
public AlleleEffectRadioactive() {
|
||||
super("radioactive", true, 40, false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,8 +22,8 @@ import forestry.api.genetics.IEffectData;
|
||||
|
||||
public class AlleleEffectRepulsion extends AlleleEffectThrottled {
|
||||
|
||||
public AlleleEffectRepulsion(String uid) {
|
||||
super(uid, "repulsion", false, 100, true, true);
|
||||
public AlleleEffectRepulsion() {
|
||||
super("repulsion", false, 100, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -72,8 +72,8 @@ public class AlleleEffectResurrection extends AlleleEffectThrottled {
|
||||
|
||||
private final List<Resurrectable> resurrectables;
|
||||
|
||||
public AlleleEffectResurrection(String uid, String name, List<Resurrectable> resurrectables) {
|
||||
super(uid, name, true, 40, true, true);
|
||||
public AlleleEffectResurrection(String name, List<Resurrectable> resurrectables) {
|
||||
super(name, true, 40, true, true);
|
||||
this.resurrectables = resurrectables;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ import forestry.core.vect.Vect;
|
||||
|
||||
public class AlleleEffectSnowing extends AlleleEffectThrottled {
|
||||
|
||||
public AlleleEffectSnowing(String uid) {
|
||||
super(uid, "snowing", false, 20, true, true);
|
||||
public AlleleEffectSnowing() {
|
||||
super("snowing", false, 20, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -38,7 +38,8 @@ public class AlleleEffectSnowing extends AlleleEffectThrottled {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
EnumTemperature temp = EnumTemperature.getFromValue(BiomeGenBase.getBiome(housing.getBiomeId()).temperature);
|
||||
BiomeGenBase biome = housing.getBiome();
|
||||
EnumTemperature temp = EnumTemperature.getFromBiome(biome);
|
||||
|
||||
switch (temp) {
|
||||
case HELLISH:
|
||||
|
||||
@@ -17,20 +17,19 @@ import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.EffectData;
|
||||
import forestry.core.genetics.alleles.AlleleCategorized;
|
||||
import forestry.core.vect.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public abstract class AlleleEffectThrottled extends Allele implements IAlleleBeeEffect {
|
||||
public abstract class AlleleEffectThrottled extends AlleleCategorized implements IAlleleBeeEffect {
|
||||
|
||||
private boolean isCombinable = false;
|
||||
private final int throttle;
|
||||
private boolean requiresWorkingQueen = false;
|
||||
|
||||
public AlleleEffectThrottled(String uid, String name, boolean isDominant, int throttle, boolean requiresWorking, boolean isCombinable) {
|
||||
super(uid, isDominant);
|
||||
this.name = "apiculture.effect." + name;
|
||||
public AlleleEffectThrottled(String name, boolean isDominant, int throttle, boolean requiresWorking, boolean isCombinable) {
|
||||
super("forestry", "effect", name, isDominant);
|
||||
this.throttle = throttle;
|
||||
this.isCombinable = isCombinable;
|
||||
this.requiresWorkingQueen = requiresWorking;
|
||||
|
||||
@@ -12,18 +12,14 @@ package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleFlowers;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.alleles.AlleleCategorized;
|
||||
|
||||
public class AlleleFlowers extends Allele implements IAlleleFlowers {
|
||||
public class AlleleFlowers extends AlleleCategorized implements IAlleleFlowers {
|
||||
|
||||
private final IFlowerProvider provider;
|
||||
|
||||
public AlleleFlowers(String uid, IFlowerProvider provider) {
|
||||
this(uid, provider, false);
|
||||
}
|
||||
|
||||
public AlleleFlowers(String uid, IFlowerProvider provider, boolean isDominant) {
|
||||
super(uid, isDominant);
|
||||
public AlleleFlowers(String modId, String category, String name, IFlowerProvider provider, boolean isDominant) {
|
||||
super(modId, category, name, isDominant);
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.genetics.BreedingTracker;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class ApiaristTracker extends BreedingTracker implements IApiaristTracker {
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ApiaristTracker extends BreedingTracker implements IApiaristTracker
|
||||
if (!individual.isPureBred(EnumBeeChromosome.SPECIES)) {
|
||||
return;
|
||||
}
|
||||
if (PluginApiculture.beeInterface.getCombinations(individual.getGenome().getPrimary()).size() > 0) {
|
||||
if (BeeManager.beeRoot.getCombinations(individual.getGenome().getPrimary()).size() > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class ApiaristTracker extends BreedingTracker implements IApiaristTracker
|
||||
|
||||
@Override
|
||||
protected IBreedingTracker getBreedingTracker(EntityPlayer player) {
|
||||
return PluginApiculture.beeInterface.getBreedingTracker(player.worldObj, player.getGameProfile());
|
||||
return BeeManager.beeRoot.getBreedingTracker(player.worldObj, player.getGameProfile());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -24,6 +26,7 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
@@ -36,13 +39,13 @@ import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorState;
|
||||
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;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.arboriculture.genetics.FakePollinatable;
|
||||
@@ -57,7 +60,6 @@ import forestry.core.utils.GeneticsUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.vect.MutableVect;
|
||||
import forestry.core.vect.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
@@ -93,7 +95,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
|
||||
if (nbttagcompound == null) {
|
||||
this.genome = PluginApiculture.beeInterface.templateAsGenome(BeeTemplates.getForestTemplate());
|
||||
genome = BeeDefinition.FOREST.getGenome();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -110,7 +112,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
if (nbttagcompound.hasKey("Genome")) {
|
||||
genome = new BeeGenome(nbttagcompound.getCompoundTag("Genome"));
|
||||
} else {
|
||||
genome = PluginApiculture.beeInterface.templateAsGenome(BeeTemplates.getForestTemplate());
|
||||
genome = BeeDefinition.FOREST.getGenome();
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKey("Mate")) {
|
||||
@@ -137,11 +139,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
this.isNatural = flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIrregularMating() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isNatural() {
|
||||
return this.isNatural;
|
||||
}
|
||||
@@ -245,52 +242,56 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isWorking(IBeeHousing housing) {
|
||||
return canWork(housing).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumErrorCode canWork(IBeeHousing housing) {
|
||||
|
||||
public Set<IErrorState> getCanWork(IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
BiomeGenBase biome = housing.getBiome();
|
||||
|
||||
ImmutableSet.Builder<IErrorState> errorStates = ImmutableSet.builder();
|
||||
|
||||
// / Rain needs tolerant flyers
|
||||
if (world.isRaining() && !genome.getTolerantFlyer() && BiomeHelper.canRainOrSnow(housing.getBiomeId()) && !housing.isSealed()) {
|
||||
return EnumErrorCode.ISRAINING;
|
||||
if (world.isRaining() && !genome.getTolerantFlyer() && BiomeHelper.canRainOrSnow(biome) && !housing.isSealed()) {
|
||||
errorStates.add(EnumErrorCode.ISRAINING);
|
||||
}
|
||||
|
||||
// / Night or darkness requires nocturnal species
|
||||
if (world.isDaytime()) {
|
||||
if (!canWorkDuringDay()) {
|
||||
return EnumErrorCode.NOTNIGHT;
|
||||
errorStates.add(EnumErrorCode.NOTNIGHT);
|
||||
}
|
||||
} else if (!canWorkAtNight() && !housing.isSelfLighted()) {
|
||||
return EnumErrorCode.NOTDAY;
|
||||
errorStates.add(EnumErrorCode.NOTDAY);
|
||||
}
|
||||
|
||||
if (world.getBlockLightValue(housing.getXCoord(), housing.getYCoord() + 2, housing.getZCoord()) > Defaults.APIARY_MIN_LEVEL_LIGHT) {
|
||||
if (!canWorkDuringDay()) {
|
||||
return EnumErrorCode.NOTGLOOMY;
|
||||
errorStates.add(EnumErrorCode.NOTGLOOMY);
|
||||
}
|
||||
} else if (!canWorkAtNight() && !housing.isSelfLighted()) {
|
||||
return EnumErrorCode.NOTLUCID;
|
||||
errorStates.add(EnumErrorCode.NOTLUCID);
|
||||
}
|
||||
|
||||
// / No sky, except if in hell
|
||||
BiomeGenBase biome = BiomeGenBase.getBiome(housing.getBiomeId());
|
||||
if (biome == null) {
|
||||
return EnumErrorCode.NOSKY;
|
||||
}
|
||||
if (!BiomeHelper.isBiomeHellish(biome) && !world.canBlockSeeTheSky(housing.getXCoord(), housing.getYCoord() + 3, housing.getZCoord())
|
||||
&& !genome.getCaveDwelling() && !housing.isSunlightSimulated()) {
|
||||
return EnumErrorCode.NOSKY;
|
||||
if (biome != null && !BiomeHelper.isBiomeHellish(biome) && !world.canBlockSeeTheSky(housing.getXCoord(), housing.getYCoord() + 3, housing.getZCoord())
|
||||
&& !genome.getCaveDwelling() && !housing.isSunlightSimulated()) {
|
||||
errorStates.add(EnumErrorCode.NOSKY);
|
||||
}
|
||||
|
||||
// / And finally climate check
|
||||
if (!isSuitableClimate(housing.getTemperature(), housing.getHumidity())) {
|
||||
return EnumErrorCode.INVALIDBIOME;
|
||||
errorStates.add(EnumErrorCode.INVALIDBIOME);
|
||||
}
|
||||
|
||||
return EnumErrorCode.OK;
|
||||
return errorStates.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IErrorState canWork(IBeeHousing housing) {
|
||||
Set<IErrorState> errorStates = getCanWork(housing);
|
||||
if (errorStates.size() == 0) {
|
||||
return EnumErrorCode.OK;
|
||||
} else {
|
||||
return errorStates.iterator().next();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canWorkAtNight() {
|
||||
@@ -343,18 +344,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return hasFlower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Integer> getSuitableBiomeIds() {
|
||||
ArrayList<Integer> suitableBiomes = new ArrayList<Integer>();
|
||||
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (isSuitableBiome(biome)) {
|
||||
suitableBiomes.add(biome.biomeID);
|
||||
}
|
||||
}
|
||||
|
||||
return suitableBiomes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<BiomeGenBase> getSuitableBiomes() {
|
||||
ArrayList<BiomeGenBase> suitableBiomes = new ArrayList<BiomeGenBase>();
|
||||
@@ -403,15 +392,15 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
IAlleleTolerance tempToleranceAllele = (IAlleleTolerance) getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceAllele = (IAlleleTolerance) getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
|
||||
String unlocalizedCustomSpeed = "tooltip.worker." + speedAllele.getUnlocalizedName().replaceFirst("gui.", "");
|
||||
String unlocalizedCustomSpeed = "tooltip.worker." + speedAllele.getUnlocalizedName().replaceAll("(.*)\\.", "");
|
||||
String speed;
|
||||
if (StringUtil.canTranslate(unlocalizedCustomSpeed)) {
|
||||
speed = StringUtil.localize(unlocalizedCustomSpeed);
|
||||
} else {
|
||||
speed = speedAllele.getName() + " " + StringUtil.localize("gui.worker");
|
||||
speed = speedAllele.getName() + ' ' + StringUtil.localize("gui.worker");
|
||||
}
|
||||
|
||||
String lifespan = genome.getActiveAllele(EnumBeeChromosome.LIFESPAN).getName() + " " + StringUtil.localize("gui.life");
|
||||
String lifespan = genome.getActiveAllele(EnumBeeChromosome.LIFESPAN).getName() + ' ' + StringUtil.localize("gui.life");
|
||||
String tempTolerance = EnumChatFormatting.GREEN + "T: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getTemperature()) + " / " + tempToleranceAllele.getName();
|
||||
String humidTolerance = EnumChatFormatting.GREEN + "H: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getHumidity()) + " / " + humidToleranceAllele.getName();
|
||||
String flowers = genome.getFlowerProvider().getDescription();
|
||||
@@ -425,11 +414,15 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
if (genome.getNocturnal()) {
|
||||
list.add(EnumChatFormatting.RED + GenericRatings.rateActivityTime(genome.getNocturnal(), false));
|
||||
}
|
||||
|
||||
if (genome.getTolerantFlyer()) {
|
||||
list.add(EnumChatFormatting.WHITE + StringUtil.localize("gui.flyer.tooltip"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void age(World world, float housingLifespanModifier) {
|
||||
IBeekeepingMode mode = PluginApiculture.beeInterface.getBeekeepingMode(world);
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getBeekeepingMode(world);
|
||||
float finalModifier = housingLifespanModifier * mode.getLifespanModifier(genome, mate, housingLifespanModifier);
|
||||
|
||||
super.age(world, finalModifier);
|
||||
@@ -482,7 +475,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
Proxies.log.warning("Failed to produce in an apiary because the beehousing was null.");
|
||||
return null;
|
||||
}
|
||||
IBeekeepingMode mode = PluginApiculture.beeInterface.getBeekeepingMode(housing.getWorld());
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getBeekeepingMode(housing.getWorld());
|
||||
if (mode == null) {
|
||||
Proxies.log.warning("Failed to produce in an apiary because the beekeeping mode was null.");
|
||||
return null;
|
||||
@@ -540,7 +533,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
// Fatigued queens do not produce princesses.
|
||||
if (PluginApiculture.beeInterface.getBeekeepingMode(housing.getWorld()).isFatigued(this, housing)) {
|
||||
if (BeeManager.beeRoot.getBeekeepingMode(housing.getWorld()).isFatigued(this, housing)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -559,7 +552,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
ArrayList<IBee> bees = new ArrayList<IBee>();
|
||||
|
||||
int toCreate = PluginApiculture.beeInterface.getBeekeepingMode(world).getFinalFertility(this, world, housing.getXCoord(), housing.getYCoord(),
|
||||
int toCreate = BeeManager.beeRoot.getBeekeepingMode(world).getFinalFertility(this, world, housing.getXCoord(), housing.getYCoord(),
|
||||
housing.getZCoord());
|
||||
|
||||
if (toCreate <= 0) {
|
||||
@@ -606,19 +599,19 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
}
|
||||
|
||||
IBeekeepingMode mode = PluginApiculture.beeInterface.getBeekeepingMode(world);
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getBeekeepingMode(world);
|
||||
return new Bee(new BeeGenome(chromosomes), mode.isNaturalOffspring(this), generation);
|
||||
}
|
||||
|
||||
private IChromosome[] mutateSpecies(IBeeHousing housing, IGenome genomeOne, IGenome genomeTwo) {
|
||||
private static IChromosome[] mutateSpecies(IBeeHousing housing, IBeeGenome genomeOne, IBeeGenome genomeTwo) {
|
||||
|
||||
World world = housing.getWorld();
|
||||
|
||||
IChromosome[] parent1 = genomeOne.getChromosomes();
|
||||
IChromosome[] parent2 = genomeTwo.getChromosomes();
|
||||
|
||||
IGenome genome0;
|
||||
IGenome genome1;
|
||||
IBeeGenome genome0;
|
||||
IBeeGenome genome1;
|
||||
IAllele allele0;
|
||||
IAllele allele1;
|
||||
|
||||
@@ -636,12 +629,12 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
genome1 = genomeOne;
|
||||
}
|
||||
|
||||
for (IBeeMutation mutation : PluginApiculture.beeInterface.getMutations(true)) {
|
||||
for (IBeeMutation mutation : BeeManager.beeRoot.getMutations(true)) {
|
||||
float chance = mutation.getChance(housing, allele0, allele1, genome0, genome1);
|
||||
if (chance > world.rand.nextFloat() * 100) {
|
||||
IApiaristTracker breedingTracker = PluginApiculture.beeInterface.getBreedingTracker(world, housing.getOwnerName());
|
||||
IApiaristTracker breedingTracker = BeeManager.beeRoot.getBreedingTracker(world, housing.getOwnerName());
|
||||
breedingTracker.registerMutation(mutation);
|
||||
return PluginApiculture.beeInterface.templateAsChromosomes(mutation.getTemplate());
|
||||
return BeeManager.beeRoot.templateAsChromosomes(mutation.getTemplate());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.core.genetics.alleles.Allele;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
|
||||
public enum BeeBranchDefinition {
|
||||
HONEY("Apis"),
|
||||
NOBLE("Probapis"),
|
||||
INDUSTRIOUS("Industrapis"),
|
||||
HEROIC("Herapis"),
|
||||
INFERNAL("Diapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_2);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.NOCTURNAL, true);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.NETHER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.AVERAGE);
|
||||
}
|
||||
},
|
||||
AUSTERE("Modapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.NOCTURNAL, true);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.CACTI);
|
||||
}
|
||||
},
|
||||
TROPICAL("Caldapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.JUNGLE);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.EFFECT, Allele.effectMiasmic);
|
||||
}
|
||||
},
|
||||
END("Finapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.LOW);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.LARGE);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.END);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.NOCTURNAL, true);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.EFFECT, Allele.effectMisanthrope);
|
||||
}
|
||||
},
|
||||
FROZEN("Coagapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.SNOW);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.EFFECT, Allele.effectGlacial);
|
||||
}
|
||||
},
|
||||
VENGEFUL("Punapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.LARGEST);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.EFFECT, Allele.effectRadioactive);
|
||||
}
|
||||
},
|
||||
FESTIVE("Festapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_2);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
}
|
||||
},
|
||||
AGRARIAN("Rustapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.FASTER);
|
||||
}
|
||||
},
|
||||
BOGGY("Paludapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.MUSHROOMS);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOWER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
}
|
||||
},
|
||||
MONASTIC("Monapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.LOW);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.FASTER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.CAVE_DWELLING, true);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
private final IClassification branch;
|
||||
|
||||
BeeBranchDefinition(String scientific) {
|
||||
branch = BeeManager.beeFactory.createBranch(this.name().toLowerCase(), scientific);
|
||||
}
|
||||
|
||||
protected void setBranchProperties(IAllele[] template) {
|
||||
|
||||
}
|
||||
|
||||
public final IAllele[] getTemplate() {
|
||||
IAllele[] template = getDefaultTemplate();
|
||||
setBranchProperties(template);
|
||||
return template;
|
||||
}
|
||||
|
||||
public final IClassification getBranch() {
|
||||
return branch;
|
||||
}
|
||||
|
||||
private static IAllele[] defaultTemplate;
|
||||
|
||||
private static IAllele[] getDefaultTemplate() {
|
||||
if (defaultTemplate == null) {
|
||||
defaultTemplate = new IAllele[EnumBeeChromosome.values().length];
|
||||
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.NORMAL);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.NOCTURNAL, false);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.TOLERANT_FLYER, false);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.CAVE_DWELLING, false);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.VANILLA);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOWEST);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.AVERAGE);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.EFFECT, Allele.effectNone);
|
||||
}
|
||||
return Arrays.copyOf(defaultTemplate, defaultTemplate.length);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,30 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpeciesCustom;
|
||||
import forestry.api.apiculture.IBeeFactory;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
public class BeeFactory implements IBeeFactory {
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor) {
|
||||
IAlleleBeeSpeciesCustom species = new AlleleBeeSpecies(uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, primaryColor, secondaryColor);
|
||||
AlleleManager.alleleRegistry.registerAllele(species);
|
||||
return species;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClassification createBranch(String uid, String scientific) {
|
||||
return new BranchBees(uid, scientific);
|
||||
}
|
||||
}
|
||||
@@ -13,24 +13,23 @@ package forestry.apiculture.genetics;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
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;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.genetics.AlleleArea;
|
||||
import forestry.core.genetics.AlleleBoolean;
|
||||
import forestry.core.genetics.AlleleTolerance;
|
||||
import forestry.core.genetics.Genome;
|
||||
import forestry.core.genetics.alleles.AlleleArea;
|
||||
import forestry.core.genetics.alleles.AlleleBoolean;
|
||||
import forestry.core.genetics.alleles.AlleleTolerance;
|
||||
import forestry.core.vect.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class BeeGenome extends Genome implements IBeeGenome {
|
||||
/**
|
||||
@@ -73,12 +72,7 @@ public class BeeGenome extends Genome implements IBeeGenome {
|
||||
|
||||
// NBT RETRIEVAL
|
||||
public static IAlleleBeeSpecies getSpecies(ItemStack itemStack) {
|
||||
IAllele speciesAllele = Genome.getActiveAllele(itemStack, EnumBeeChromosome.SPECIES);
|
||||
if (speciesAllele instanceof IAlleleBeeSpecies) {
|
||||
return (IAlleleBeeSpecies) speciesAllele;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return (IAlleleBeeSpecies) getActiveAllele(itemStack, EnumBeeChromosome.SPECIES, BeeManager.beeRoot);
|
||||
}
|
||||
|
||||
// / INFORMATION RETRIEVAL
|
||||
@@ -155,6 +149,6 @@ public class BeeGenome extends Genome implements IBeeGenome {
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return PluginApiculture.beeInterface;
|
||||
return BeeManager.beeRoot;
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import com.mojang.authlib.GameProfile;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
@@ -215,13 +216,13 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
|
||||
@Override
|
||||
public void registerTemplate(String identifier, IAllele[] template) {
|
||||
beeTemplates.add(new Bee(PluginApiculture.beeInterface.templateAsGenome(template)));
|
||||
beeTemplates.add(new Bee(BeeManager.beeRoot.templateAsGenome(template)));
|
||||
speciesTemplates.put(identifier, template);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getDefaultTemplate() {
|
||||
return BeeTemplates.getDefaultTemplate();
|
||||
return BeeDefinition.FOREST.getTemplate();
|
||||
}
|
||||
|
||||
/* MUTATIONS */
|
||||
|
||||
@@ -10,124 +10,57 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeeMutationCustom;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.core.genetics.Mutation;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class BeeMutation extends Mutation implements IBeeMutation {
|
||||
public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
|
||||
private final IBeeRoot root;
|
||||
|
||||
boolean requiresDay = false;
|
||||
boolean requiresNight = false;
|
||||
|
||||
private final ArrayList<BiomeDictionary.Type> restrictBiomeTypes = new ArrayList<BiomeDictionary.Type>();
|
||||
private boolean strictBiomeCheck = false;
|
||||
|
||||
public BeeMutation(IAllele allele0, IAllele allele1, IAllele[] template, int chance) {
|
||||
super(allele0, allele1, template, chance);
|
||||
|
||||
root = (IBeeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
|
||||
PluginApiculture.beeInterface.registerMutation(this);
|
||||
public BeeMutation(IAlleleBeeSpecies bee0, IAlleleBeeSpecies bee1, IAllele[] result, int chance) {
|
||||
super(bee0, bee1, result, chance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeRoot getRoot() {
|
||||
return root;
|
||||
}
|
||||
|
||||
public BeeMutation enableStrictBiomeCheck() {
|
||||
strictBiomeCheck = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BeeMutation restrictBiomeType(BiomeDictionary.Type type) {
|
||||
restrictBiomeTypes.add(type);
|
||||
specialConditions.add(String.format("Is restricted to %s-like environments.", type.toString()));
|
||||
return this;
|
||||
}
|
||||
|
||||
public BeeMutation requireDay() {
|
||||
requiresDay = true;
|
||||
requiresNight = false;
|
||||
specialConditions.add("Can only occur during the day.");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BeeMutation requireNight() {
|
||||
requiresDay = false;
|
||||
requiresNight = true;
|
||||
specialConditions.add("Can only occur during the night.");
|
||||
return this;
|
||||
return BeeManager.beeRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
return getChance(housing, (IAlleleBeeSpecies) allele0, (IAlleleBeeSpecies) allele1, (IBeeGenome) genome0, (IBeeGenome) genome1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(IBeeHousing housing, IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, IBeeGenome genome0, IBeeGenome genome1) {
|
||||
|
||||
World world = housing.getWorld();
|
||||
if (requiresDay && !world.isDaytime()) {
|
||||
return 0;
|
||||
}
|
||||
int x = housing.getXCoord();
|
||||
int y = housing.getYCoord();
|
||||
int z = housing.getZCoord();
|
||||
|
||||
if (requiresNight && world.isDaytime()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Skip if we are restricted by biomes and this one does not match.
|
||||
if (restrictBiomeTypes.size() > 0) {
|
||||
boolean noneMatched = true;
|
||||
|
||||
BiomeGenBase biome = BiomeGenBase.getBiome(housing.getBiomeId());
|
||||
if (strictBiomeCheck) {
|
||||
BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(biome);
|
||||
if (types.length == 1 && restrictBiomeTypes.contains(types[0])) {
|
||||
noneMatched = false;
|
||||
}
|
||||
} else {
|
||||
for (BiomeDictionary.Type type : restrictBiomeTypes) {
|
||||
if (BiomeDictionary.isBiomeOfType(biome, type)) {
|
||||
noneMatched = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (noneMatched) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(housing.getXCoord(), housing.getZCoord());
|
||||
if (biome.temperature < minTemperature || biome.temperature > maxTemperature) {
|
||||
return 0;
|
||||
}
|
||||
if (biome.rainfall < minRainfall || biome.rainfall > maxRainfall) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
float processedChance = chance * housing.getMutationModifier((IBeeGenome) genome0, (IBeeGenome) genome1, 1f)
|
||||
* PluginApiculture.beeInterface.getBeekeepingMode(world).getMutationModifier((IBeeGenome) genome0, (IBeeGenome) genome1, 1f);
|
||||
float processedChance = super.getChance(world, x, y, z, allele0, allele1, genome0, genome1);
|
||||
if (processedChance <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (this.allele0.getUID().equals(allele0.getUID()) && this.allele1.getUID().equals(allele1.getUID())) {
|
||||
processedChance *= housing.getMutationModifier(genome0, genome1, 1f);
|
||||
processedChance *= BeeManager.beeRoot.getBeekeepingMode(world).getMutationModifier(genome0, genome1, 1f);
|
||||
if (processedChance <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (this.species0.getUID().equals(allele0.getUID()) && this.species1.getUID().equals(allele1.getUID())) {
|
||||
return processedChance;
|
||||
}
|
||||
if (this.allele1.getUID().equals(allele0.getUID()) && this.allele0.getUID().equals(allele1.getUID())) {
|
||||
if (this.species1.getUID().equals(allele0.getUID()) && this.species0.getUID().equals(allele1.getUID())) {
|
||||
return processedChance;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeMutationCustom;
|
||||
import forestry.api.apiculture.IBeeMutationFactory;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public class BeeMutationFactory implements IBeeMutationFactory {
|
||||
|
||||
@Override
|
||||
public IBeeMutationCustom createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, IAllele[] result, int chance) {
|
||||
IBeeMutationCustom mutation = new BeeMutation(parentBee0, parentBee1, result, chance);
|
||||
BeeManager.beeRoot.registerMutation(mutation);
|
||||
return mutation;
|
||||
}
|
||||
}
|
||||
@@ -1,640 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.core.genetics.Allele;
|
||||
|
||||
public class BeeTemplates {
|
||||
|
||||
// / MUTATIONS
|
||||
public static IMutation commonA;
|
||||
|
||||
public static IMutation commonB;
|
||||
public static IMutation commonC;
|
||||
|
||||
public static IMutation commonD;
|
||||
public static IMutation commonE;
|
||||
public static IMutation commonF;
|
||||
|
||||
public static IMutation commonG;
|
||||
public static IMutation commonH;
|
||||
public static IMutation commonI;
|
||||
public static IMutation commonJ;
|
||||
|
||||
public static IMutation commonK;
|
||||
public static IMutation commonL;
|
||||
public static IMutation commonM;
|
||||
public static IMutation commonN;
|
||||
public static IMutation commonO;
|
||||
|
||||
public static IMutation cultivatedA;
|
||||
public static IMutation cultivatedB;
|
||||
public static IMutation cultivatedC;
|
||||
public static IMutation cultivatedD;
|
||||
public static IMutation cultivatedE;
|
||||
public static IMutation cultivatedF;
|
||||
|
||||
public static IMutation nobleA;
|
||||
public static IMutation majesticA;
|
||||
public static IMutation imperialA;
|
||||
|
||||
public static IMutation diligentA;
|
||||
public static IMutation unwearyA;
|
||||
public static IMutation industriousA;
|
||||
|
||||
public static IMutation heroicA;
|
||||
|
||||
public static IMutation sinisterA;
|
||||
public static IMutation sinisterB;
|
||||
public static IMutation fiendishA;
|
||||
public static IMutation fiendishB;
|
||||
public static IMutation fiendishC;
|
||||
public static IMutation demonicA;
|
||||
|
||||
// Austere branch
|
||||
public static IMutation frugalA;
|
||||
public static IMutation frugalB;
|
||||
public static IMutation austereA;
|
||||
|
||||
// Tropical branch
|
||||
public static IMutation exoticA;
|
||||
public static IMutation edenicA;
|
||||
|
||||
// Wintry branch
|
||||
public static IMutation icyA;
|
||||
public static IMutation glacialA;
|
||||
|
||||
// Festive branch
|
||||
public static IMutation leporineA;
|
||||
public static IMutation merryA;
|
||||
public static IMutation tipsyA;
|
||||
public static IMutation trickyA;
|
||||
|
||||
// Agrarian branch
|
||||
public static IMutation ruralA;
|
||||
|
||||
// Monastic branch
|
||||
public static IMutation secludedA;
|
||||
public static IMutation hermiticA;
|
||||
|
||||
// End branch
|
||||
public static IMutation spectralA;
|
||||
public static IMutation phantasmalA;
|
||||
|
||||
public static IMutation vindictiveA;
|
||||
|
||||
public static IMutation vengefulA;
|
||||
public static IMutation vengefulB;
|
||||
public static IMutation avengingA;
|
||||
|
||||
public static IAllele[] defaultTemplate;
|
||||
|
||||
public static IAllele[] getDefaultTemplate() {
|
||||
if (defaultTemplate == null) {
|
||||
defaultTemplate = new IAllele[EnumBeeChromosome.values().length];
|
||||
|
||||
defaultTemplate[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesForest;
|
||||
defaultTemplate[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlowest;
|
||||
defaultTemplate[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanShorter;
|
||||
defaultTemplate[EnumBeeChromosome.FERTILITY.ordinal()] = Allele.fertilityNormal;
|
||||
defaultTemplate[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceNone;
|
||||
defaultTemplate[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.boolFalse;
|
||||
defaultTemplate[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceNone;
|
||||
defaultTemplate[EnumBeeChromosome.TOLERANT_FLYER.ordinal()] = Allele.boolFalse;
|
||||
defaultTemplate[EnumBeeChromosome.CAVE_DWELLING.ordinal()] = Allele.boolFalse;
|
||||
defaultTemplate[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowersVanilla;
|
||||
defaultTemplate[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.floweringSlowest;
|
||||
defaultTemplate[EnumBeeChromosome.TERRITORY.ordinal()] = Allele.territoryDefault;
|
||||
defaultTemplate[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectNone;
|
||||
}
|
||||
return Arrays.copyOf(defaultTemplate, defaultTemplate.length);
|
||||
}
|
||||
|
||||
// / COMMON BRANCH
|
||||
|
||||
public static IAllele[] getForestTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.floweringSlower;
|
||||
alleles[EnumBeeChromosome.FERTILITY.ordinal()] = Allele.fertilityHigh;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getForestRainResistTemplate() {
|
||||
IAllele[] alleles = getForestTemplate();
|
||||
alleles[EnumBeeChromosome.TOLERANT_FLYER.ordinal()] = Allele.boolTrue;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getMeadowsTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesMeadows;
|
||||
alleles[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.floweringSlower;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getCommonTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesCommon;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getCultivatedTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesCultivated;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedFast;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanShortest;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
// / NOBLE BRANCH
|
||||
|
||||
public static IAllele[] getNobleTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesNoble;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanShort;
|
||||
alleles[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.floweringSlow;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getMajesticTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesMajestic;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedNorm;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanShortened;
|
||||
alleles[EnumBeeChromosome.FERTILITY.ordinal()] = Allele.fertilityMaximum;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getImperialTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesImperial;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanNormal;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectBeatific;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
// / INDUSTRIOUS BRANCH
|
||||
|
||||
public static IAllele[] getDiligentTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesDiligent;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanShort;
|
||||
alleles[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.floweringSlow;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getUnwearyTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesUnweary;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedNorm;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanShortened;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getIndustriousTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesIndustrious;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanNormal;
|
||||
alleles[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.floweringFast;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
// / HEROIC BRANCH
|
||||
|
||||
public static IAllele[] getSteadfastTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesSteadfast;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanNormal;
|
||||
alleles[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.CAVE_DWELLING.ordinal()] = Allele.boolTrue;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getValiantTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesValiant;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlow;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanLong;
|
||||
alleles[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.CAVE_DWELLING.ordinal()] = Allele.boolTrue;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getHeroicTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesHeroic;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlow;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanLong;
|
||||
alleles[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.CAVE_DWELLING.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectHeroic;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
// / INFERNAL BRANCH
|
||||
|
||||
public static IAllele[] getBranchInfernalTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceDown2;
|
||||
alleles[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowersNether;
|
||||
alleles[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.floweringAverage;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getSinisterTemplate() {
|
||||
IAllele[] alleles = getBranchInfernalTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesSinister;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanNormal;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectAggressive;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getFiendishTemplate() {
|
||||
IAllele[] alleles = getBranchInfernalTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesFiendish;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedNorm;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanLong;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectAggressive;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getDemonicTemplate() {
|
||||
IAllele[] alleles = getBranchInfernalTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesDemonic;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanLonger;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectIgnition;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
// / AUSTERE BRANCH
|
||||
|
||||
public static IAllele[] getAustereBranchTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceBoth1;
|
||||
alleles[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceDown1;
|
||||
alleles[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowersCacti;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getModestTemplate() {
|
||||
IAllele[] alleles = getAustereBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesModest;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanShort;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getFrugalTemplate() {
|
||||
IAllele[] alleles = getAustereBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesFrugal;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedNorm;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanLong;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getAustereTemplate() {
|
||||
IAllele[] alleles = getAustereBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesAustere;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlowest;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanLonger;
|
||||
alleles[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceDown2;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectCreeper;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
// / TROPICAL BRANCH
|
||||
public static IAllele[] getTropicalBranchTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceUp1;
|
||||
alleles[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceUp1;
|
||||
alleles[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowersJungle;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectMiasmic;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getTropicalTemplate() {
|
||||
IAllele[] alleles = getTropicalBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesTropical;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanShort;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getExoticTemplate() {
|
||||
IAllele[] alleles = getTropicalBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesExotic;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedNorm;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanLong;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getEdenicTemplate() {
|
||||
IAllele[] alleles = getTropicalBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesEdenic;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlowest;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanLonger;
|
||||
alleles[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceBoth2;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectExploration;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
// / END BRANCH
|
||||
public static IAllele[] getEndBranchTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.FERTILITY.ordinal()] = Allele.fertilityLow;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanLonger;
|
||||
alleles[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceUp1;
|
||||
alleles[EnumBeeChromosome.TERRITORY.ordinal()] = Allele.territoryLarge;
|
||||
alleles[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowersEnd;
|
||||
alleles[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectMisanthrope;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getEnderTemplate() {
|
||||
IAllele[] alleles = getEndBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesEnded;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getSpectralTemplate() {
|
||||
IAllele[] alleles = getEndBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesSpectral;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectReanimation;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getPhantasmalTemplate() {
|
||||
IAllele[] alleles = getEndBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesPhantasmal;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlowest;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanLongest;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectResurrection;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
// / FROZEN BRANCH
|
||||
public static IAllele[] getFrozenBranchTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceUp1;
|
||||
alleles[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceBoth1;
|
||||
alleles[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowersSnow;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectGlacial;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getWintryTemplate() {
|
||||
IAllele[] alleles = getFrozenBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesWintry;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanShort;
|
||||
alleles[EnumBeeChromosome.FERTILITY.ordinal()] = Allele.fertilityMaximum;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getIcyTemplate() {
|
||||
IAllele[] alleles = getFrozenBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesIcy;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlow;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanShort;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getGlacialTemplate() {
|
||||
IAllele[] alleles = getFrozenBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesGlacial;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanShort;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
// / VENGEFUL BRANCH
|
||||
public static IAllele[] getVengefulBranchTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.TERRITORY.ordinal()] = Allele.territoryLargest;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectRadioactive;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getVindictiveTemplate() {
|
||||
IAllele[] alleles = getVengefulBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesVindictive;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanNormal;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getVengefulTemplate() {
|
||||
IAllele[] alleles = getVengefulBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesVengeful;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedNorm;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanLonger;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getAvengingTemplate() {
|
||||
IAllele[] alleles = getVengefulBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesAvenging;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlowest;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanLongest;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
// / REDDENED BRANCH
|
||||
public static IAllele[] getReddenedBranchTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlow;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanNormal;
|
||||
alleles[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceBoth2;
|
||||
alleles[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceBoth1;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getDarkenedTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesDarkened;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getReddenedTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesReddened;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getOmegaTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesOmega;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
// / FESTIVE BRANCH
|
||||
public static IAllele[] getFestiveBranchTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceBoth2;
|
||||
alleles[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceBoth1;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanNormal;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getLeporineTemplate() {
|
||||
IAllele[] alleles = getFestiveBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesLeporine;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectFestiveEaster;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getMerryTemplate() {
|
||||
IAllele[] alleles = getFestiveBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesMerry;
|
||||
alleles[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectSnowing;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getTipsyTemplate() {
|
||||
IAllele[] alleles = getFestiveBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesTipsy;
|
||||
alleles[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectDrunkard;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getTrickyTemplate() {
|
||||
IAllele[] alleles = getFestiveBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesTricky;
|
||||
alleles[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.TOLERANT_FLYER.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowersGourd;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
// / AGRARIAN BRANCH
|
||||
public static IAllele[] getAgrarianBranchTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanShorter;
|
||||
alleles[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowersWheat;
|
||||
alleles[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.floweringFaster;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getRuralTemplate() {
|
||||
IAllele[] alleles = getAgrarianBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesRural;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getFarmerlyTemplate() {
|
||||
IAllele[] alleles = getAgrarianBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesFarmerly;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlow;
|
||||
alleles[EnumBeeChromosome.TERRITORY.ordinal()] = Allele.territoryLarge;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getAgrarianTemplate() {
|
||||
IAllele[] alleles = getAgrarianBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesArgrarian;
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlow;
|
||||
alleles[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceBoth2;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectFertile;
|
||||
alleles[EnumBeeChromosome.TERRITORY.ordinal()] = Allele.territoryLarge;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
// / BOGGY BRANCH
|
||||
public static IAllele[] getBoggyBranchTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowersMushrooms;
|
||||
alleles[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.floweringSlower;
|
||||
alleles[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceBoth1;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getMarshyTemplate() {
|
||||
IAllele[] alleles = getBoggyBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesMarshy;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getMiryTemplate() {
|
||||
IAllele[] alleles = getBoggyBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesMiry;
|
||||
alleles[EnumBeeChromosome.FERTILITY.ordinal()] = Allele.fertilityMaximum;
|
||||
alleles[EnumBeeChromosome.TOLERANT_FLYER.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.boolTrue;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getBoggyTemplate() {
|
||||
IAllele[] alleles = getBoggyBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesBoggy;
|
||||
alleles[EnumBeeChromosome.TOLERANT_FLYER.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectMycophilic;
|
||||
alleles[EnumBeeChromosome.TERRITORY.ordinal()] = Allele.territoryLarger;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
/* MONASTIC BRANCH */
|
||||
public static IAllele[] getMonasticBranchTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumBeeChromosome.SPEED.ordinal()] = Allele.speedSlower;
|
||||
alleles[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.lifespanLong;
|
||||
alleles[EnumBeeChromosome.FERTILITY.ordinal()] = Allele.fertilityLow;
|
||||
alleles[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.floweringFaster;
|
||||
alleles[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceBoth1;
|
||||
alleles[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceBoth1;
|
||||
alleles[EnumBeeChromosome.CAVE_DWELLING.ordinal()] = Allele.boolTrue;
|
||||
alleles[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowersWheat;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getMonasticTemplate() {
|
||||
IAllele[] alleles = getMonasticBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesMonastic;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getSecludedTemplate() {
|
||||
IAllele[] alleles = getMonasticBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesSecluded;
|
||||
alleles[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.floweringFastest;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getHermiticTemplate() {
|
||||
IAllele[] alleles = getMonasticBranchTemplate();
|
||||
alleles[EnumBeeChromosome.SPECIES.ordinal()] = Allele.speciesHermitic;
|
||||
alleles[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.floweringFastest;
|
||||
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectRepulsion;
|
||||
return alleles;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.genetics.alleles.Allele;
|
||||
|
||||
public abstract class BeeVariation implements IBeeDefinition {
|
||||
|
||||
private final IAllele[] template;
|
||||
private final IBeeGenome genome;
|
||||
|
||||
public BeeVariation(IBeeDefinition bee) {
|
||||
template = bee.getTemplate();
|
||||
initializeTemplate(template);
|
||||
genome = BeeManager.beeRoot.templateAsGenome(template);
|
||||
}
|
||||
|
||||
protected abstract void initializeTemplate(IAllele[] template);
|
||||
|
||||
@Override
|
||||
public IAllele[] getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeGenome getGenome() {
|
||||
return genome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBee getIndividual() {
|
||||
return new Bee(genome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ItemStack getMemberStack(EnumBeeType beeType) {
|
||||
IBee bee = getIndividual();
|
||||
return BeeManager.beeRoot.getMemberStack(bee, beeType.ordinal());
|
||||
}
|
||||
|
||||
public static class RainResist extends BeeVariation {
|
||||
public RainResist(IBeeDefinition bee) {
|
||||
super(bee);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeTemplate(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.TOLERANT_FLYER, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,25 +12,25 @@ package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class HiveDrop implements IHiveDrop {
|
||||
|
||||
private final IAllele[] template;
|
||||
private final IBeeDefinition beeTemplate;
|
||||
private final ArrayList<ItemStack> additional = new ArrayList<ItemStack>();
|
||||
private final int chance;
|
||||
private float ignobleShare = 0.0f;
|
||||
|
||||
public HiveDrop(IAllele[] template, ItemStack[] bonus, int chance) {
|
||||
this.template = template;
|
||||
public HiveDrop(int chance, IBeeDefinition beeTemplate, ItemStack... bonus) {
|
||||
this.beeTemplate = beeTemplate;
|
||||
this.chance = chance;
|
||||
|
||||
Collections.addAll(this.additional, bonus);
|
||||
@@ -41,25 +41,20 @@ public class HiveDrop implements IHiveDrop {
|
||||
return this;
|
||||
}
|
||||
|
||||
private IBee createBee(World world) {
|
||||
return PluginApiculture.beeInterface.getBee(world, PluginApiculture.beeInterface.templateAsGenome(template));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPrincess(World world, int x, int y, int z, int fortune) {
|
||||
IBee bee = createBee(world);
|
||||
IBee bee = beeTemplate.getIndividual();
|
||||
if (world.rand.nextFloat() < ignobleShare) {
|
||||
bee.setIsNatural(false);
|
||||
}
|
||||
|
||||
return PluginApiculture.beeInterface.getMemberStack(bee, EnumBeeType.PRINCESS.ordinal());
|
||||
return BeeManager.beeRoot.getMemberStack(bee, EnumBeeType.PRINCESS.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrones(World world, int x, int y, int z, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
ret.add(PluginApiculture.beeInterface.getMemberStack(createBee(world), EnumBeeType.DRONE.ordinal()));
|
||||
return ret;
|
||||
public List<ItemStack> getDrones(World world, int x, int y, int z, int fortune) {
|
||||
ItemStack drone = beeTemplate.getMemberStack(EnumBeeType.DRONE);
|
||||
return Collections.singletonList(drone);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.core.genetics.IGeneticDefinition;
|
||||
|
||||
public interface IBeeDefinition extends IGeneticDefinition {
|
||||
@Override
|
||||
IBeeGenome getGenome();
|
||||
|
||||
@Override
|
||||
IBee getIndividual();
|
||||
|
||||
ItemStack getMemberStack(EnumBeeType beeType);
|
||||
}
|
||||
@@ -16,25 +16,38 @@ import net.minecraft.world.biome.BiomeGenBase;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IJubilanceProvider;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.vect.Vect;
|
||||
|
||||
public class JubilanceDefault implements IJubilanceProvider {
|
||||
|
||||
@Override
|
||||
public boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing) {
|
||||
BiomeGenBase biome = BiomeGenBase.getBiome(housing.getBiomeId());
|
||||
private static JubilanceDefault instance;
|
||||
|
||||
if (EnumTemperature.getFromValue(biome.temperature) != species.getTemperature() ||
|
||||
EnumHumidity.getFromValue(biome.rainfall) != species.getHumidity()) {
|
||||
return false;
|
||||
public static JubilanceDefault getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new JubilanceDefault();
|
||||
}
|
||||
|
||||
return true;
|
||||
return instance;
|
||||
}
|
||||
|
||||
protected AxisAlignedBB getBounding(IBeeGenome genome, IBeeHousing housing, float modifier) {
|
||||
protected JubilanceDefault() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing) {
|
||||
BiomeGenBase biome = housing.getBiome();
|
||||
|
||||
EnumTemperature temperature = EnumTemperature.getFromBiome(biome);
|
||||
EnumHumidity humidity = EnumHumidity.getFromValue(biome.rainfall);
|
||||
|
||||
return temperature == species.getTemperature() && humidity == species.getHumidity();
|
||||
|
||||
}
|
||||
|
||||
protected static AxisAlignedBB getBounding(IBeeGenome genome, IBeeHousing housing, float modifier) {
|
||||
int[] areaAr = genome.getTerritory();
|
||||
Vect area = new Vect(areaAr[0], areaAr[1], areaAr[2]).multiply(modifier);
|
||||
Vect offset = new Vect(-Math.round(area.x / 2), -Math.round(area.y / 2), -Math.round(area.z / 2));
|
||||
|
||||
Executable → Regular
+28
-19
@@ -1,19 +1,28 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
|
||||
public interface IJubilanceProvider {
|
||||
boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing);
|
||||
}
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import forestry.api.apiculture.IJubilanceFactory;
|
||||
import forestry.api.apiculture.IJubilanceProvider;
|
||||
|
||||
public class JubilanceFactory implements IJubilanceFactory {
|
||||
@Override
|
||||
public IJubilanceProvider getDefault() {
|
||||
return JubilanceDefault.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IJubilanceProvider getRequiresResource(Block block, int meta) {
|
||||
return new JubilanceRequiresResource(block, meta);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class JubilanceProviderHermit extends JubilanceDefault {
|
||||
|
||||
@Override
|
||||
public boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing) {
|
||||
AxisAlignedBB bounding = this.getBounding(genome, housing, 1.0f);
|
||||
AxisAlignedBB bounding = getBounding(genome, housing, 1.0f);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
List list = housing.getWorld().getEntitiesWithinAABB(EntityLiving.class, bounding);
|
||||
|
||||
Executable → Regular
+4
-8
@@ -17,23 +17,19 @@ import net.minecraft.world.World;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IJubilanceProvider;
|
||||
import forestry.core.utils.StackUtils;
|
||||
|
||||
public class JubilanceReqRes implements IJubilanceProvider {
|
||||
public class JubilanceRequiresResource implements IJubilanceProvider {
|
||||
|
||||
private final ItemStack blockRequired;
|
||||
|
||||
public JubilanceReqRes(ItemStack blockRequired) {
|
||||
this.blockRequired = blockRequired;
|
||||
public JubilanceRequiresResource(Block block, int meta) {
|
||||
this.blockRequired = new ItemStack(block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing) {
|
||||
|
||||
if (blockRequired == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
World world = housing.getWorld();
|
||||
|
||||
Block block = world.getBlock(housing.getXCoord(), housing.getYCoord() - 1, housing.getZCoord());
|
||||
@@ -1,102 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.vect.Vect;
|
||||
|
||||
public class MutationEMC extends MutationReqRes {
|
||||
|
||||
private final int emcRequired;
|
||||
private final Class<?> condenserClass;
|
||||
private final Field emcField;
|
||||
|
||||
public MutationEMC(IAllele allele0, IAllele allele1, IAllele[] template, int chance, ItemStack blockRequired, Class<?> condenserClass, Field emcField,
|
||||
int emcRequired) {
|
||||
super(allele0, allele1, template, chance, blockRequired);
|
||||
|
||||
this.condenserClass = condenserClass;
|
||||
this.emcField = emcField;
|
||||
this.emcRequired = emcRequired;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
float chance = super.getChance(housing, allele0, allele1, genome0, genome1);
|
||||
|
||||
// If we don't have any chance, return at once.
|
||||
if (chance <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (emcRequired <= 0) {
|
||||
return chance;
|
||||
}
|
||||
|
||||
World world = housing.getWorld();
|
||||
|
||||
Vect[] possibleTargets = new Vect[]{new Vect(housing.getXCoord() + 1, housing.getYCoord(), housing.getZCoord()),
|
||||
new Vect(housing.getXCoord() - 1, housing.getYCoord(), housing.getZCoord()),
|
||||
new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord() + 1),
|
||||
new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord() - 1)};
|
||||
|
||||
for (Vect target : possibleTargets) {
|
||||
if (!world.blockExists(target.x, target.y, target.z)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
TileEntity entity = world.getTileEntity(target.x, target.y, target.z);
|
||||
if (entity == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!condenserClass.isInstance(entity)) {
|
||||
Proxies.log.warning("Did not find a relay at " + target.toString());
|
||||
continue;
|
||||
}
|
||||
|
||||
int emc = 0;
|
||||
try {
|
||||
emc = emcField.getInt(entity);
|
||||
} catch (Exception ex) {
|
||||
Proxies.log.warning("Failed to fetch EMC information.");
|
||||
}
|
||||
|
||||
if (emc < emcRequired * 80) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean removedEMC = false;
|
||||
try {
|
||||
emcField.set(entity, emc - (emcRequired * 80));
|
||||
removedEMC = true;
|
||||
} catch (Exception ex) {
|
||||
Proxies.log.warning("Failed to set EMC information.");
|
||||
}
|
||||
|
||||
if (removedEMC) {
|
||||
return chance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.core.utils.StackUtils;
|
||||
|
||||
public class MutationReqRes extends BeeMutation {
|
||||
|
||||
private final ItemStack blockRequired;
|
||||
|
||||
public MutationReqRes(IAllele allele0, IAllele allele1, IAllele[] template, int chance, ItemStack blockRequired) {
|
||||
super(allele0, allele1, template, chance);
|
||||
this.blockRequired = blockRequired;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
float chance = super.getChance(housing, allele0, allele1, genome0, genome1);
|
||||
|
||||
// If we have no chance anyway, we don't need to check.
|
||||
if (chance <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
World world = housing.getWorld();
|
||||
if (blockRequired == null) {
|
||||
return chance;
|
||||
}
|
||||
|
||||
Block block = world.getBlock(housing.getXCoord(), housing.getYCoord() - 1, housing.getZCoord());
|
||||
int meta = world.getBlockMetadata(housing.getXCoord(), housing.getYCoord() - 1, housing.getZCoord());
|
||||
if (StackUtils.equals(block, blockRequired) && meta == blockRequired.getItemDamage()) {
|
||||
return chance;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
public class MutationTimeLimited extends BeeMutation {
|
||||
|
||||
/**
|
||||
* Fed up with Date and Calendar and their shenanigans
|
||||
*/
|
||||
public static class DayMonth {
|
||||
|
||||
public final int day;
|
||||
public final int month;
|
||||
|
||||
public DayMonth() {
|
||||
this.day = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
|
||||
this.month = Calendar.getInstance().get(Calendar.MONTH) + 1;
|
||||
}
|
||||
|
||||
public DayMonth(int day, int month) {
|
||||
this.day = day;
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public boolean between(DayMonth start, DayMonth end) {
|
||||
if (equals(start) || equals(end)) {
|
||||
return true;
|
||||
}
|
||||
if (start.month > end.month) {
|
||||
return after(start) || before(end);
|
||||
}
|
||||
return after(start) && before(end);
|
||||
}
|
||||
|
||||
public boolean before(DayMonth other) {
|
||||
|
||||
if (other.month > this.month) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (other.month < this.month) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.day < other.day;
|
||||
}
|
||||
|
||||
public boolean after(DayMonth other) {
|
||||
|
||||
if (other.month < this.month) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (other.month > this.month) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.day > other.day;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 89 * hash + this.day;
|
||||
hash = 89 * hash + this.month;
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final DayMonth other = (DayMonth) obj;
|
||||
if (this.day != other.day) {
|
||||
return false;
|
||||
}
|
||||
if (this.month != other.month) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return day + "." + month;
|
||||
}
|
||||
}
|
||||
|
||||
private final DayMonth start;
|
||||
private final DayMonth end;
|
||||
|
||||
public MutationTimeLimited(IAllele allele0, IAllele allele1, IAllele[] template, int chance, DayMonth start) {
|
||||
this(allele0, allele1, template, chance, start, null);
|
||||
}
|
||||
|
||||
public MutationTimeLimited(IAllele allele0, IAllele allele1, IAllele[] template, int chance, DayMonth start, DayMonth end) {
|
||||
super(allele0, allele1, template, chance);
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
float chance = super.getChance(housing, allele0, allele1, genome0, genome1);
|
||||
|
||||
if (chance == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (start == null) {
|
||||
return chance;
|
||||
}
|
||||
|
||||
DayMonth now = new DayMonth();
|
||||
|
||||
// If we are equal to start day, return chance.
|
||||
if (Calendar.getInstance().get(Calendar.DAY_OF_MONTH) == start.day && Calendar.getInstance().get(Calendar.MONTH) + 1 == start.month) {
|
||||
return chance;
|
||||
}
|
||||
|
||||
// Still here but not time span? No mutation!
|
||||
if (end == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Equal to end date, return chance.
|
||||
if (Calendar.getInstance().get(Calendar.DAY_OF_MONTH) == end.day && Calendar.getInstance().get(Calendar.MONTH) + 1 == end.month) {
|
||||
return chance;
|
||||
}
|
||||
|
||||
// Still a chance we are in between
|
||||
if (now.between(start, end)) {
|
||||
return chance;
|
||||
}
|
||||
|
||||
// Now we finally failed.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -12,21 +12,17 @@ package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import forestry.apiculture.gadgets.TileAlvearyPlain;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.gui.ContainerTile;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
|
||||
public class ContainerAlveary extends ContainerForestry {
|
||||
|
||||
private final TileAlvearyPlain tile;
|
||||
public class ContainerAlveary extends ContainerTile<TileAlvearyPlain> {
|
||||
|
||||
public ContainerAlveary(InventoryPlayer player, TileAlvearyPlain tile) {
|
||||
super(tile);
|
||||
super(tile, player, 8, 108);
|
||||
|
||||
this.tile = tile;
|
||||
tile.sendNetworkUpdate();
|
||||
|
||||
// Queen/Princess
|
||||
@@ -43,17 +39,6 @@ public class ContainerAlveary extends ContainerForestry {
|
||||
this.addSlotToContainer(new SlotOutput(tile, 6, 95, 65));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 7, 95, 39));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 8, 116, 26));
|
||||
|
||||
// Player inventory
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 108 + i * 18));
|
||||
}
|
||||
}
|
||||
// Player hotbar
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new Slot(player, i, 8 + i * 18, 166));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,5 +53,4 @@ public class ContainerAlveary extends ContainerForestry {
|
||||
tile.sendGUINetworkData(this, (ICrafting) crafter);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,30 +10,18 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.gadgets.TileAlvearyHygroregulator;
|
||||
import forestry.core.gui.ContainerLiquidTanks;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
|
||||
public class ContainerAlvearyHygroregulator extends ContainerLiquidTanks {
|
||||
public class ContainerAlvearyHygroregulator extends ContainerLiquidTanks<TileAlvearyHygroregulator> {
|
||||
|
||||
public ContainerAlvearyHygroregulator(IInventory playerInventory, TileAlvearyHygroregulator tile) {
|
||||
super(tile);
|
||||
public ContainerAlvearyHygroregulator(InventoryPlayer playerInventory, TileAlvearyHygroregulator tile) {
|
||||
super(tile, playerInventory, 8, 84);
|
||||
|
||||
this.addSlotToContainer(new SlotFiltered(tile, TileAlvearyHygroregulator.SLOT_INPUT, 56, 38));
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int var4 = 0; var4 < 9; ++var4) {
|
||||
this.addSlotToContainer(new Slot(playerInventory, var4 + i * 9 + 9, 8 + var4 * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(playerInventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,17 +11,16 @@
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import forestry.apiculture.gadgets.TileAlvearySieve;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.gui.ContainerTile;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
|
||||
public class ContainerAlvearySieve extends ContainerForestry {
|
||||
public class ContainerAlvearySieve extends ContainerTile<TileAlvearySieve> {
|
||||
|
||||
public ContainerAlvearySieve(InventoryPlayer player, TileAlvearySieve tile) {
|
||||
super(tile);
|
||||
super(tile, player, 8, 87);
|
||||
|
||||
addSlotToContainer(new SlotOutput(tile, 0, 94, 52).setCrafter(tile));
|
||||
addSlotToContainer(new SlotOutput(tile, 1, 115, 39).setCrafter(tile));
|
||||
@@ -29,18 +28,5 @@ public class ContainerAlvearySieve extends ContainerForestry {
|
||||
addSlotToContainer(new SlotOutput(tile, 3, 94, 26).setCrafter(tile));
|
||||
|
||||
addSlotToContainer(new SlotFiltered(tile, TileAlvearySieve.SLOT_SIEVE, 43, 39).setCrafter(tile));
|
||||
|
||||
// Player inventory
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 87 + i * 18));
|
||||
}
|
||||
}
|
||||
// Player hotbar
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new Slot(player, i, 8 + i * 18, 145));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,32 +11,19 @@
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import forestry.apiculture.gadgets.TileAlvearySwarmer;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.gui.ContainerTile;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
|
||||
public class ContainerAlvearySwarmer extends ContainerForestry {
|
||||
public class ContainerAlvearySwarmer extends ContainerTile<TileAlvearySwarmer> {
|
||||
|
||||
public ContainerAlvearySwarmer(InventoryPlayer player, TileAlvearySwarmer tile) {
|
||||
super(tile);
|
||||
super(tile, player, 8, 87);
|
||||
|
||||
this.addSlotToContainer(new SlotFiltered(tile, 0, 79, 52));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, 1, 100, 39));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, 2, 58, 39));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, 3, 79, 26));
|
||||
|
||||
// Player inventory
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 87 + i * 18));
|
||||
}
|
||||
}
|
||||
// Player hotbar
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new Slot(player, i, 8 + i * 18, 145));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -12,21 +12,17 @@ package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import forestry.apiculture.gadgets.TileBeehouse;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.gui.ContainerTile;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
|
||||
public class ContainerApiary extends ContainerForestry {
|
||||
|
||||
private final TileBeehouse tile;
|
||||
public class ContainerApiary extends ContainerTile<TileBeehouse> {
|
||||
|
||||
public ContainerApiary(InventoryPlayer player, TileBeehouse tile, boolean hasFrames) {
|
||||
super(tile);
|
||||
super(tile, player, 8, 108);
|
||||
|
||||
this.tile = tile;
|
||||
tile.sendNetworkUpdate();
|
||||
|
||||
// Queen/Princess
|
||||
@@ -50,17 +46,6 @@ public class ContainerApiary extends ContainerForestry {
|
||||
this.addSlotToContainer(new SlotOutput(tile, 6, 95, 65));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 7, 95, 39));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 8, 116, 26));
|
||||
|
||||
// Player inventory
|
||||
for (int i1 = 0; i1 < 3; i1++) {
|
||||
for (int l1 = 0; l1 < 9; l1++) {
|
||||
addSlotToContainer(new Slot(player, l1 + i1 * 9 + 9, 8 + l1 * 18, 108 + i1 * 18));
|
||||
}
|
||||
}
|
||||
// Player hotbar
|
||||
for (int j1 = 0; j1 < 9; j1++) {
|
||||
addSlotToContainer(new Slot(player, j1, 8 + j1 * 18, 166));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.apiculture.items.ItemHabitatLocator.HabitatLocatorInventory;
|
||||
import forestry.core.gui.ContainerItemInventory;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
|
||||
public class ContainerHabitatLocator extends ContainerItemInventory {
|
||||
public class ContainerHabitatLocator extends ContainerItemInventory<HabitatLocatorInventory> {
|
||||
|
||||
public ContainerHabitatLocator(InventoryPlayer inventoryplayer, HabitatLocatorInventory inventory) {
|
||||
super(inventory, inventoryplayer.player);
|
||||
public ContainerHabitatLocator(EntityPlayer player, HabitatLocatorInventory inventory) {
|
||||
super(inventory, player.inventory, 8, 102);
|
||||
|
||||
// Energy
|
||||
this.addSlotToContainer(new SlotFiltered(inventory, 2, 152, 8));
|
||||
@@ -29,16 +29,5 @@ public class ContainerHabitatLocator extends ContainerItemInventory {
|
||||
this.addSlotToContainer(new SlotFiltered(inventory, 0, 152, 32));
|
||||
// Analyzed bee
|
||||
this.addSlotToContainer(new SlotOutput(inventory, 1, 152, 75));
|
||||
|
||||
// Player inventory
|
||||
for (int i1 = 0; i1 < 3; i1++) {
|
||||
for (int l1 = 0; l1 < 9; l1++) {
|
||||
addSecuredSlot(inventoryplayer, l1 + i1 * 9 + 9, 8 + l1 * 18, 102 + i1 * 18);
|
||||
}
|
||||
}
|
||||
// Player hotbar
|
||||
for (int j1 = 0; j1 < 9; j1++) {
|
||||
addSecuredSlot(inventoryplayer, j1, 8 + j1 * 18, 160);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,11 @@ package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.apiculture.items.ItemImprinter.ImprinterInventory;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.gui.ContainerItemInventory;
|
||||
import forestry.core.gui.IGuiSelectable;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
@@ -26,30 +25,17 @@ import forestry.core.network.PacketPayload;
|
||||
import forestry.core.network.PacketUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
public class ContainerImprinter extends ContainerForestry implements IGuiSelectable {
|
||||
public class ContainerImprinter extends ContainerItemInventory<ImprinterInventory> implements IGuiSelectable {
|
||||
|
||||
public final ImprinterInventory inventory;
|
||||
private boolean isNetSynced = false;
|
||||
|
||||
public ContainerImprinter(InventoryPlayer inventoryplayer, ImprinterInventory inventory) {
|
||||
super(inventory);
|
||||
super(inventory, inventoryplayer, 8, 103);
|
||||
|
||||
this.inventory = inventory;
|
||||
// Input
|
||||
this.addSlotToContainer(new SlotFiltered(inventory, 0, 152, 12));
|
||||
// Output
|
||||
this.addSlotToContainer(new SlotOutput(inventory, 1, 152, 72));
|
||||
|
||||
// Player inventory
|
||||
for (int i1 = 0; i1 < 3; i1++) {
|
||||
for (int l1 = 0; l1 < 9; l1++) {
|
||||
addSlotToContainer(new Slot(inventoryplayer, l1 + i1 * 9 + 9, 8 + l1 * 18, 103 + i1 * 18));
|
||||
}
|
||||
}
|
||||
// Player hotbar
|
||||
for (int j1 = 0; j1 < 9; j1++) {
|
||||
addSlotToContainer(new Slot(inventoryplayer, j1, 8 + j1 * 18, 161));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,7 +55,6 @@ public class ContainerImprinter extends ContainerForestry implements IGuiSelecta
|
||||
Proxies.common.dropItemPlayer(entityplayer, stack);
|
||||
inventory.setInventorySlotContents(i, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void advanceSelection(int index, World world) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.ArrayList;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
@@ -27,12 +28,11 @@ 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.AlleleBoolean;
|
||||
import forestry.core.genetics.alleles.AlleleBoolean;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.gui.GuiAlyzer;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.vect.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class GuiBeealyzer extends GuiAlyzer {
|
||||
|
||||
@@ -65,8 +65,8 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
if (inventory.getStackInSlot(k) == null) {
|
||||
continue;
|
||||
}
|
||||
bee = PluginApiculture.beeInterface.getMember(inventory.getStackInSlot(k));
|
||||
beeType = PluginApiculture.beeInterface.getType(inventory.getStackInSlot(k));
|
||||
bee = BeeManager.beeRoot.getMember(inventory.getStackInSlot(k));
|
||||
beeType = BeeManager.beeRoot.getType(inventory.getStackInSlot(k));
|
||||
if (bee == null || !bee.isAnalyzed()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
@@ -103,8 +102,8 @@ public class GuiHabitatLocator extends GuiForestry<ContainerHabitatLocator, Habi
|
||||
private int startX;
|
||||
private int startY;
|
||||
|
||||
public GuiHabitatLocator(InventoryPlayer inventory, HabitatLocatorInventory item) {
|
||||
super(Defaults.TEXTURE_PATH_GUI + "/biomefinder.png", new ContainerHabitatLocator(inventory, item), item);
|
||||
public GuiHabitatLocator(EntityPlayer player, HabitatLocatorInventory item) {
|
||||
super(Defaults.TEXTURE_PATH_GUI + "/biomefinder.png", new ContainerHabitatLocator(player, item), item);
|
||||
|
||||
this.inventory.tryAnalyze();
|
||||
xSize = 176;
|
||||
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
@@ -38,7 +39,6 @@ import forestry.apiculture.genetics.BeeGenome;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.genetics.ItemGE;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class ItemBeeGE extends ItemGE {
|
||||
|
||||
@@ -123,7 +123,7 @@ public class ItemBeeGE extends ItemGE {
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public void addCreativeItems(List itemList, boolean hideSecrets) {
|
||||
|
||||
for (IIndividual individual : PluginApiculture.beeInterface.getIndividualTemplates()) {
|
||||
for (IIndividual individual : BeeManager.beeRoot.getIndividualTemplates()) {
|
||||
// Don't show secret bees unless ordered to.
|
||||
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
|
||||
continue;
|
||||
@@ -188,7 +188,7 @@ public class ItemBeeGE extends ItemGE {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromSpecies(IAlleleBeeSpecies species, int renderPass) {
|
||||
if (species == null) {
|
||||
species = (IAlleleBeeSpecies) PluginApiculture.beeInterface.getDefaultTemplate()[EnumBeeChromosome.SPECIES.ordinal()];
|
||||
species = (IAlleleBeeSpecies) BeeManager.beeRoot.getDefaultTemplate()[EnumBeeChromosome.SPECIES.ordinal()];
|
||||
}
|
||||
|
||||
return species.getIcon(type, renderPass);
|
||||
|
||||
@@ -15,31 +15,28 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
import forestry.core.interfaces.IHintSource;
|
||||
import forestry.core.inventory.AlyzerInventory;
|
||||
import forestry.core.items.ItemInventoried;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class ItemBeealyzer extends ItemInventoried {
|
||||
|
||||
public static class BeealyzerInventory extends AlyzerInventory implements IErrorSource, IHintSource {
|
||||
public static class BeealyzerInventory extends AlyzerInventory implements IHintSource {
|
||||
|
||||
public BeealyzerInventory(EntityPlayer player, ItemStack itemStack) {
|
||||
super(ItemBeealyzer.class, 7, itemStack);
|
||||
this.player = player;
|
||||
super(player, 7, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSpecimen(ItemStack itemStack) {
|
||||
return PluginApiculture.beeInterface.isMember(itemStack);
|
||||
return BeeManager.beeRoot.isMember(itemStack);
|
||||
}
|
||||
|
||||
private void tryAnalyze() {
|
||||
@@ -48,7 +45,7 @@ public class ItemBeealyzer extends ItemInventoried {
|
||||
return;
|
||||
}
|
||||
|
||||
IBee bee = PluginApiculture.beeInterface.getMember(getStackInSlot(SLOT_SPECIMEN));
|
||||
IBee bee = BeeManager.beeRoot.getMember(getStackInSlot(SLOT_SPECIMEN));
|
||||
// No bee, abort
|
||||
if (bee == null) {
|
||||
return;
|
||||
@@ -64,8 +61,8 @@ public class ItemBeealyzer extends ItemInventoried {
|
||||
|
||||
bee.analyze();
|
||||
if (player != null) {
|
||||
PluginApiculture.beeInterface.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(bee.getGenome().getPrimary());
|
||||
PluginApiculture.beeInterface.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(bee.getGenome().getSecondary());
|
||||
BeeManager.beeRoot.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(bee.getGenome().getPrimary());
|
||||
BeeManager.beeRoot.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(bee.getGenome().getSecondary());
|
||||
}
|
||||
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
@@ -82,8 +79,6 @@ public class ItemBeealyzer extends ItemInventoried {
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
// if (!Proxies.common.isSimulating(player.worldObj))
|
||||
// return;
|
||||
tryAnalyze();
|
||||
}
|
||||
|
||||
@@ -97,21 +92,6 @@ public class ItemBeealyzer extends ItemInventoried {
|
||||
public String[] getHints() {
|
||||
return Config.hints.get("beealyzer");
|
||||
}
|
||||
|
||||
// / IERRORSOURCE
|
||||
@Override
|
||||
public boolean throwsErrors() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumErrorCode getErrorState() {
|
||||
if (PluginApiculture.beeInterface.isMember(inventoryStacks[SLOT_SPECIMEN]) && !isEnergy(getStackInSlot(SLOT_ENERGY))) {
|
||||
return EnumErrorCode.NOHONEY;
|
||||
}
|
||||
|
||||
return EnumErrorCode.OK;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemBeealyzer() {
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ItemCandleBlock extends ItemForestryBlock {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamageForRenderPass(int meta, int pass) {
|
||||
return ((BlockCandle) this.getBlock()).getTextureFromPassAndMeta((meta != 0) ? 8 : 0, pass);
|
||||
return this.getBlock().getIcon((meta != 0) ? 8 : 0, pass);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -32,10 +34,12 @@ import net.minecraftforge.common.BiomeDictionary;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.apiculture.render.TextureHabitatLocator;
|
||||
@@ -50,7 +54,6 @@ import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.vect.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class ItemHabitatLocator extends ItemInventoried {
|
||||
|
||||
@@ -63,8 +66,8 @@ public class ItemHabitatLocator extends ItemInventoried {
|
||||
public Set<BiomeGenBase> biomesToSearch = new HashSet<BiomeGenBase>();
|
||||
private final ItemHabitatLocator habitatLocator;
|
||||
|
||||
public HabitatLocatorInventory(ItemStack itemstack) {
|
||||
super(ItemHabitatLocator.class, 3, itemstack);
|
||||
public HabitatLocatorInventory(EntityPlayer player, ItemStack itemstack) {
|
||||
super(player, 3, itemstack);
|
||||
this.habitatLocator = (ItemHabitatLocator) itemstack.getItem();
|
||||
}
|
||||
|
||||
@@ -91,7 +94,7 @@ public class ItemHabitatLocator extends ItemInventoried {
|
||||
setInventorySlotContents(SLOT_SPECIMEN, null);
|
||||
}
|
||||
|
||||
IBee bee = PluginApiculture.beeInterface.getMember(getStackInSlot(SLOT_ANALYZED));
|
||||
IBee bee = BeeManager.beeRoot.getMember(getStackInSlot(SLOT_ANALYZED));
|
||||
|
||||
// No bee, abort
|
||||
if (bee == null) {
|
||||
@@ -120,17 +123,23 @@ public class ItemHabitatLocator extends ItemInventoried {
|
||||
|
||||
// / IERRORSOURCE
|
||||
@Override
|
||||
public boolean throwsErrors() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumErrorCode getErrorState() {
|
||||
if (PluginApiculture.beeInterface.isMember(inventoryStacks[SLOT_SPECIMEN]) && !isEnergy(getStackInSlot(SLOT_ENERGY))) {
|
||||
return EnumErrorCode.NOHONEY;
|
||||
public ImmutableSet<IErrorState> getErrorStates() {
|
||||
if (getStackInSlot(SLOT_ANALYZED) != null) {
|
||||
return ImmutableSet.of();
|
||||
}
|
||||
|
||||
return EnumErrorCode.OK;
|
||||
ImmutableSet.Builder<IErrorState> errorStates = ImmutableSet.builder();
|
||||
|
||||
ItemStack specimen = getStackInSlot(SLOT_SPECIMEN);
|
||||
if (!BeeManager.beeRoot.isMember(specimen)) {
|
||||
errorStates.add(EnumErrorCode.NOTHINGANALYZE);
|
||||
}
|
||||
|
||||
if (!isEnergy(getStackInSlot(SLOT_ENERGY))) {
|
||||
errorStates.add(EnumErrorCode.NOHONEY);
|
||||
}
|
||||
|
||||
return errorStates.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -139,7 +148,7 @@ public class ItemHabitatLocator extends ItemInventoried {
|
||||
Item item = itemStack.getItem();
|
||||
return item == ForestryItem.honeydew.item() || item == ForestryItem.honeyDrop.item();
|
||||
} else if (slotIndex == SLOT_SPECIMEN) {
|
||||
return PluginApiculture.beeInterface.isMember(itemStack);
|
||||
return BeeManager.beeRoot.isMember(itemStack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
@@ -24,27 +25,23 @@ import forestry.core.inventory.ItemInventory;
|
||||
import forestry.core.items.ItemForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class ItemImprinter extends ItemForestry {
|
||||
|
||||
public static class ImprinterInventory extends ItemInventory {
|
||||
|
||||
private final short specimenSlot = 0;
|
||||
private final short imprintedSlot = 1;
|
||||
private static final short specimenSlot = 0;
|
||||
private static final short imprintedSlot = 1;
|
||||
|
||||
private int primaryIndex = 0;
|
||||
private int secondaryIndex = 0;
|
||||
|
||||
private final EntityPlayer player;
|
||||
|
||||
public ImprinterInventory(EntityPlayer player, ItemStack itemStack) {
|
||||
super(ItemImprinter.class, 2, itemStack);
|
||||
this.player = player;
|
||||
super(player, 2, itemStack);
|
||||
}
|
||||
|
||||
public void advancePrimary() {
|
||||
if (primaryIndex < PluginApiculture.beeInterface.getIndividualTemplates().size() - 1) {
|
||||
if (primaryIndex < BeeManager.beeRoot.getIndividualTemplates().size() - 1) {
|
||||
primaryIndex++;
|
||||
} else {
|
||||
primaryIndex = 0;
|
||||
@@ -52,7 +49,7 @@ public class ItemImprinter extends ItemForestry {
|
||||
}
|
||||
|
||||
public void advanceSecondary() {
|
||||
if (secondaryIndex < PluginApiculture.beeInterface.getIndividualTemplates().size() - 1) {
|
||||
if (secondaryIndex < BeeManager.beeRoot.getIndividualTemplates().size() - 1) {
|
||||
secondaryIndex++;
|
||||
} else {
|
||||
secondaryIndex = 0;
|
||||
@@ -63,7 +60,7 @@ public class ItemImprinter extends ItemForestry {
|
||||
if (primaryIndex > 0) {
|
||||
primaryIndex--;
|
||||
} else {
|
||||
primaryIndex = PluginApiculture.beeInterface.getIndividualTemplates().size() - 1;
|
||||
primaryIndex = BeeManager.beeRoot.getIndividualTemplates().size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,22 +68,22 @@ public class ItemImprinter extends ItemForestry {
|
||||
if (secondaryIndex > 0) {
|
||||
secondaryIndex--;
|
||||
} else {
|
||||
secondaryIndex = PluginApiculture.beeInterface.getIndividualTemplates().size() - 1;
|
||||
secondaryIndex = BeeManager.beeRoot.getIndividualTemplates().size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public IAlleleBeeSpecies getPrimary() {
|
||||
return PluginApiculture.beeInterface.getIndividualTemplates().get(primaryIndex).getGenome().getPrimary();
|
||||
return BeeManager.beeRoot.getIndividualTemplates().get(primaryIndex).getGenome().getPrimary();
|
||||
}
|
||||
|
||||
public IAlleleBeeSpecies getSecondary() {
|
||||
return PluginApiculture.beeInterface.getIndividualTemplates().get(secondaryIndex).getGenome().getPrimary();
|
||||
return BeeManager.beeRoot.getIndividualTemplates().get(secondaryIndex).getGenome().getPrimary();
|
||||
}
|
||||
|
||||
public IBee getSelectedBee() {
|
||||
return new Bee(PluginApiculture.beeInterface.templateAsGenome(
|
||||
PluginApiculture.beeInterface.getGenomeTemplates().get(PluginApiculture.beeInterface.getIndividualTemplates().get(primaryIndex).getIdent()),
|
||||
PluginApiculture.beeInterface.getGenomeTemplates().get(PluginApiculture.beeInterface.getIndividualTemplates().get(secondaryIndex).getIdent())));
|
||||
return new Bee(BeeManager.beeRoot.templateAsGenome(
|
||||
BeeManager.beeRoot.getGenomeTemplates().get(BeeManager.beeRoot.getIndividualTemplates().get(primaryIndex).getIdent()),
|
||||
BeeManager.beeRoot.getGenomeTemplates().get(BeeManager.beeRoot.getIndividualTemplates().get(secondaryIndex).getIdent())));
|
||||
}
|
||||
|
||||
public int getPrimaryIndex() {
|
||||
@@ -107,17 +104,18 @@ public class ItemImprinter extends ItemForestry {
|
||||
|
||||
private void tryImprint() {
|
||||
|
||||
if (inventoryStacks[specimenSlot] == null) {
|
||||
ItemStack specimen = getStackInSlot(specimenSlot);
|
||||
if (specimen == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only imprint bees
|
||||
if (!PluginApiculture.beeInterface.isMember(inventoryStacks[specimenSlot])) {
|
||||
if (!BeeManager.beeRoot.isMember(specimen)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Needs space
|
||||
if (inventoryStacks[imprintedSlot] != null) {
|
||||
if (getStackInSlot(imprintedSlot) != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -128,17 +126,14 @@ public class ItemImprinter extends ItemForestry {
|
||||
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
imprint.writeToNBT(nbttagcompound);
|
||||
inventoryStacks[specimenSlot].setTagCompound(nbttagcompound);
|
||||
specimen.setTagCompound(nbttagcompound);
|
||||
|
||||
inventoryStacks[imprintedSlot] = inventoryStacks[specimenSlot];
|
||||
inventoryStacks[specimenSlot] = null;
|
||||
setInventorySlotContents(imprintedSlot, specimen);
|
||||
setInventorySlotContents(specimenSlot, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
if (!Proxies.common.isSimulating(player.worldObj)) {
|
||||
return;
|
||||
}
|
||||
tryImprint();
|
||||
}
|
||||
|
||||
@@ -149,7 +144,7 @@ public class ItemImprinter extends ItemForestry {
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
return PluginApiculture.beeInterface.isMember(itemStack);
|
||||
return BeeManager.beeRoot.isMember(itemStack);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Executable → Regular
+21
-4
@@ -8,13 +8,15 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
package forestry.apiculture.network;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import forestry.apiculture.gadgets.TileCandle;
|
||||
import forestry.apiculture.gui.ContainerImprinter;
|
||||
import forestry.core.interfaces.IPacketHandler;
|
||||
import forestry.core.network.PacketCoordinates;
|
||||
@@ -27,20 +29,28 @@ public class PacketHandlerApiculture implements IPacketHandler {
|
||||
public boolean onPacketData(int packetID, DataInputStream data, EntityPlayer player) throws IOException {
|
||||
|
||||
switch (packetID) {
|
||||
case PacketIds.HABITAT_BIOME_POINTER:
|
||||
case PacketIds.HABITAT_BIOME_POINTER: {
|
||||
PacketCoordinates packetC = new PacketCoordinates();
|
||||
packetC.readData(data);
|
||||
Proxies.common.setHabitatLocatorCoordinates(player, packetC.getCoordinates());
|
||||
return true;
|
||||
case PacketIds.IMPRINT_SELECTION_GET:
|
||||
}
|
||||
case PacketIds.IMPRINT_SELECTION_GET: {
|
||||
onImprintSelectionGet(player);
|
||||
return true;
|
||||
}
|
||||
case PacketIds.CANDLE: {
|
||||
PacketUpdateCandle updateCandle = new PacketUpdateCandle();
|
||||
updateCandle.readData(data);
|
||||
onCandleUpdate(updateCandle);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void onImprintSelectionGet(EntityPlayer playerEntity) {
|
||||
private static void onImprintSelectionGet(EntityPlayer playerEntity) {
|
||||
|
||||
if (!(playerEntity.openContainer instanceof ContainerImprinter)) {
|
||||
return;
|
||||
@@ -50,4 +60,11 @@ public class PacketHandlerApiculture implements IPacketHandler {
|
||||
|
||||
}
|
||||
|
||||
private static void onCandleUpdate(PacketUpdateCandle updateCandle) {
|
||||
TileEntity tileEntity = updateCandle.getTarget(Proxies.common.getRenderWorld());
|
||||
if (tileEntity instanceof TileCandle) {
|
||||
((TileCandle) tileEntity).onPacketUpdate(updateCandle);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package forestry.apiculture.network;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import forestry.apiculture.gadgets.TileCandle;
|
||||
import forestry.core.network.PacketCoordinates;
|
||||
import forestry.core.network.PacketIds;
|
||||
|
||||
public class PacketUpdateCandle extends PacketCoordinates {
|
||||
|
||||
private int colour;
|
||||
private boolean lit;
|
||||
|
||||
public PacketUpdateCandle() {
|
||||
|
||||
}
|
||||
|
||||
public PacketUpdateCandle(TileCandle tileCandle) {
|
||||
super(PacketIds.CANDLE, tileCandle);
|
||||
|
||||
colour = tileCandle.getColour();
|
||||
lit = tileCandle.isLit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
super.writeData(data);
|
||||
data.writeInt(colour);
|
||||
data.writeBoolean(lit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStream data) throws IOException {
|
||||
super.readData(data);
|
||||
colour = data.readInt();
|
||||
lit = data.readBoolean();
|
||||
}
|
||||
|
||||
public int getColour() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
public boolean isLit() {
|
||||
return lit;
|
||||
}
|
||||
}
|
||||
@@ -20,10 +20,10 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.apiculture.entities.EntityBee;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class BeeItemRenderer implements IItemRenderer {
|
||||
|
||||
@@ -67,16 +67,16 @@ public class BeeItemRenderer implements IItemRenderer {
|
||||
}
|
||||
|
||||
private IBee initBee(ItemStack item, boolean scaled) {
|
||||
IBee bee = PluginApiculture.beeInterface.getMember(item);
|
||||
IBee bee = BeeManager.beeRoot.getMember(item);
|
||||
if (bee == null) {
|
||||
bee = PluginApiculture.beeInterface.templateAsIndividual(PluginApiculture.beeInterface.getDefaultTemplate());
|
||||
bee = BeeManager.beeRoot.templateAsIndividual(BeeManager.beeRoot.getDefaultTemplate());
|
||||
}
|
||||
|
||||
if (entity == null) {
|
||||
entity = new EntityBee(Proxies.common.getClientInstance().theWorld);
|
||||
}
|
||||
entity.setSpecies(bee.getGenome().getPrimary());
|
||||
entity.setType(PluginApiculture.beeInterface.getType(item));
|
||||
entity.setType(BeeManager.beeRoot.getType(item));
|
||||
/*
|
||||
if(scaled)
|
||||
entity.setScale(butterfly.getSize());
|
||||
|
||||
@@ -13,6 +13,7 @@ package forestry.apiculture.render;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
@@ -26,19 +27,13 @@ public class BlockCandleRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
/*BlockCandle bc = (BlockCandle)block;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
IIcon iconA = (bc.isLit(meta)) ? bc.
|
||||
this.renderTorchAtAngle(block, -0.5D, -0.5D, -0.5D, 0.0D, 0.0D, 0);
|
||||
tessellator.draw();*/
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
if (block.getRenderType() == ForestryClient.candleRenderId) {
|
||||
this.renderBlockCandle(world, x, y, z, (BlockCandle) block, modelId, renderer);
|
||||
renderBlockCandle(world, x, y, z, (BlockCandle) block);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -53,13 +48,20 @@ public class BlockCandleRenderer implements ISimpleBlockRenderingHandler {
|
||||
return ForestryClient.candleRenderId;
|
||||
}
|
||||
|
||||
public boolean renderBlockCandle(IBlockAccess world, int x, int y, int z, BlockCandle block, int modelId, RenderBlocks renderer) {
|
||||
private static boolean renderBlockCandle(IBlockAccess world, int x, int y, int z, BlockCandle block) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
IIcon iconA = block.getTextureFromPassAndMeta(meta, 0);
|
||||
IIcon iconB = block.getTextureFromPassAndMeta(meta, 1);
|
||||
meta = meta & 0x7;
|
||||
TileCandle tc = (TileCandle) world.getTileEntity(x, y, z);
|
||||
int colour = tc.getColour();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (!(tileEntity instanceof TileCandle)) {
|
||||
return false;
|
||||
}
|
||||
TileCandle tileCandle = (TileCandle) tileEntity;
|
||||
|
||||
boolean isLit = tileCandle.isLit();
|
||||
|
||||
IIcon iconA = block.getTextureFromPassAndLit(0, isLit);
|
||||
IIcon iconB = block.getTextureFromPassAndLit(1, isLit);
|
||||
|
||||
int colour = tileCandle.getColour();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(world.getLightBrightnessForSkyBlocks(x, y, z, block.getLightValue(world, x, y, z)));
|
||||
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
|
||||
@@ -68,26 +70,26 @@ public class BlockCandleRenderer implements ISimpleBlockRenderingHandler {
|
||||
double d2 = 0.20000000298023224D;
|
||||
|
||||
if (meta == 1) {
|
||||
this.renderCandleAtAngle(iconA, x - d1, y + d2, z, -d0, 0.0D, 0xffffff);
|
||||
this.renderCandleAtAngle(iconB, x - d1, y + d2, z, -d0, 0.0D, colour);
|
||||
renderCandleAtAngle(iconA, x - d1, y + d2, z, -d0, 0.0D, 0xffffff);
|
||||
renderCandleAtAngle(iconB, x - d1, y + d2, z, -d0, 0.0D, colour);
|
||||
} else if (meta == 2) {
|
||||
this.renderCandleAtAngle(iconA, x + d1, y + d2, z, d0, 0.0D, 0xffffff);
|
||||
this.renderCandleAtAngle(iconB, x + d1, y + d2, z, d0, 0.0D, colour);
|
||||
renderCandleAtAngle(iconA, x + d1, y + d2, z, d0, 0.0D, 0xffffff);
|
||||
renderCandleAtAngle(iconB, x + d1, y + d2, z, d0, 0.0D, colour);
|
||||
} else if (meta == 3) {
|
||||
this.renderCandleAtAngle(iconA, x, y + d2, z - d1, 0.0D, -d0, 0xffffff);
|
||||
this.renderCandleAtAngle(iconB, x, y + d2, z - d1, 0.0D, -d0, colour);
|
||||
renderCandleAtAngle(iconA, x, y + d2, z - d1, 0.0D, -d0, 0xffffff);
|
||||
renderCandleAtAngle(iconB, x, y + d2, z - d1, 0.0D, -d0, colour);
|
||||
} else if (meta == 4) {
|
||||
this.renderCandleAtAngle(iconA, x, y + d2, z + d1, 0.0D, d0, 0xffffff);
|
||||
this.renderCandleAtAngle(iconB, x, y + d2, z + d1, 0.0D, d0, colour);
|
||||
renderCandleAtAngle(iconA, x, y + d2, z + d1, 0.0D, d0, 0xffffff);
|
||||
renderCandleAtAngle(iconB, x, y + d2, z + d1, 0.0D, d0, colour);
|
||||
} else {
|
||||
this.renderCandleAtAngle(iconA, x, y, z, 0.0D, 0.0D, 0xffffff);
|
||||
this.renderCandleAtAngle(iconB, x, y, z, 0.0D, 0.0D, colour);
|
||||
renderCandleAtAngle(iconA, x, y, z, 0.0D, 0.0D, 0xffffff);
|
||||
renderCandleAtAngle(iconB, x, y, z, 0.0D, 0.0D, colour);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void renderCandleAtAngle(IIcon icon, double x, double y, double z, double par8, double par10, int colour) {
|
||||
private static void renderCandleAtAngle(IIcon icon, double x, double y, double z, double par8, double par10, int colour) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
double minU = icon.getMinU();
|
||||
double minV = icon.getMinV();
|
||||
|
||||
@@ -37,8 +37,7 @@ public class TriggerMissingDrone extends Trigger {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((IErrorSource) tile).getErrorState() == EnumErrorCode.NODRONE;
|
||||
|
||||
return ((IErrorSource) tile).getErrorStates().contains(EnumErrorCode.NODRONE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,6 +37,6 @@ public class TriggerMissingQueen extends Trigger {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((IErrorSource) tile).getErrorState() == EnumErrorCode.NOQUEEN;
|
||||
return ((IErrorSource) tile).getErrorStates().contains(EnumErrorCode.NOQUEEN);
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,6 @@ import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
|
||||
@@ -310,9 +309,9 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
|
||||
TileBeehouse apiary = ((TileBeehouse) tile);
|
||||
apiary.initialize();
|
||||
apiary.setInventorySlotContents(TileBeehouse.SLOT_QUEEN,
|
||||
PluginApiculture.beeInterface.getMemberStack(getVillageBee(world, xCoord, yCoord, zCoord), EnumBeeType.PRINCESS.ordinal()));
|
||||
BeeManager.beeRoot.getMemberStack(getVillageBee(world, xCoord, yCoord, zCoord), EnumBeeType.PRINCESS.ordinal()));
|
||||
apiary.setInventorySlotContents(TileBeehouse.SLOT_DRONE,
|
||||
PluginApiculture.beeInterface.getMemberStack(getVillageBee(world, xCoord, yCoord, zCoord), EnumBeeType.DRONE.ordinal()));
|
||||
BeeManager.beeRoot.getMemberStack(getVillageBee(world, xCoord, yCoord, zCoord), EnumBeeType.DRONE.ordinal()));
|
||||
|
||||
for (int i = TileBeehouse.SLOT_FRAMES_1; i < TileBeehouse.SLOT_FRAMES_1 + TileBeehouse.SLOT_FRAMES_COUNT; i++) {
|
||||
float roll = world.rand.nextFloat();
|
||||
@@ -351,10 +350,10 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
|
||||
|
||||
// No valid ones found, return any of the common ones.
|
||||
if (valid.isEmpty()) {
|
||||
return PluginApiculture.beeInterface.getBee(world, BeeManager.villageBees[0].get(world.rand.nextInt(BeeManager.villageBees[0].size())));
|
||||
return BeeManager.beeRoot.getBee(world, BeeManager.villageBees[0].get(world.rand.nextInt(BeeManager.villageBees[0].size())));
|
||||
}
|
||||
|
||||
return PluginApiculture.beeInterface.getBee(world, valid.get(world.rand.nextInt(valid.size())));
|
||||
return BeeManager.beeRoot.getBee(world, valid.get(world.rand.nextInt(valid.size())));
|
||||
}
|
||||
|
||||
private boolean checkBiomeHazard(IBeeGenome genome, float temperature, float humidity) {
|
||||
|
||||
@@ -26,24 +26,22 @@ import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.apiculture.genetics.BeeTemplates;
|
||||
import forestry.apiculture.genetics.BeeDefinition;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public enum HiveDescription implements IHiveDescription {
|
||||
|
||||
FOREST(1, 3.0f, BeeTemplates.getForestTemplate(), HiveManager.genHelper.tree()),
|
||||
MEADOWS(2, 1.0f, BeeTemplates.getMeadowsTemplate(), HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass)),
|
||||
DESERT(3, 1.0f, BeeTemplates.getModestTemplate(), HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass, Blocks.sand, Blocks.sandstone)),
|
||||
JUNGLE(4, 4.0f, BeeTemplates.getTropicalTemplate(), HiveManager.genHelper.tree()),
|
||||
END(5, 4.0f, BeeTemplates.getEnderTemplate(), HiveManager.genHelper.ground(Blocks.end_stone)) {
|
||||
FOREST(1, 3.0f, BeeDefinition.FOREST, HiveManager.genHelper.tree()),
|
||||
MEADOWS(2, 1.0f, BeeDefinition.MEADOWS, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass)),
|
||||
DESERT(3, 1.0f, BeeDefinition.MODEST, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass, Blocks.sand, Blocks.sandstone)),
|
||||
JUNGLE(4, 4.0f, BeeDefinition.TROPICAL, HiveManager.genHelper.tree()),
|
||||
END(5, 4.0f, BeeDefinition.ENDED, HiveManager.genHelper.ground(Blocks.end_stone)) {
|
||||
@Override
|
||||
public boolean isGoodBiome(BiomeGenBase biome) {
|
||||
return BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END);
|
||||
}
|
||||
},
|
||||
SNOW(6, 2.0f, BeeTemplates.getWintryTemplate(), HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass, Blocks.snow)) {
|
||||
SNOW(6, 2.0f, BeeDefinition.WINTRY, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass, Blocks.snow)) {
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z) {
|
||||
if (world.isAirBlock(x, y + 1, z)) {
|
||||
@@ -51,17 +49,17 @@ public enum HiveDescription implements IHiveDescription {
|
||||
}
|
||||
}
|
||||
},
|
||||
SWAMP(7, 2.0f, BeeTemplates.getMarshyTemplate(), HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass)),;
|
||||
SWAMP(7, 2.0f, BeeDefinition.MARSHY, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass)),;
|
||||
|
||||
private final int meta;
|
||||
private final float genChance;
|
||||
private final IBeeGenome beeGenome;
|
||||
private final IHiveGen hiveGen;
|
||||
|
||||
HiveDescription(int meta, float genChance, IAllele[] beeTemplate, IHiveGen hiveGen) {
|
||||
HiveDescription(int meta, float genChance, BeeDefinition beeTemplate, IHiveGen hiveGen) {
|
||||
this.meta = meta;
|
||||
this.genChance = genChance;
|
||||
this.beeGenome = PluginApiculture.beeInterface.templateAsGenome(beeTemplate);
|
||||
this.beeGenome = beeTemplate.getGenome();
|
||||
this.hiveGen = hiveGen;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -33,6 +34,11 @@ public class HiveRegistry implements IHiveRegistry {
|
||||
hives.put(hiveName, hive);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDrops(String hiveName, IHiveDrop... drops) {
|
||||
addDrops(hiveName, Arrays.asList(drops));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDrops(String hiveName, List<IHiveDrop> drops) {
|
||||
Hive hive = hives.get(hiveName);
|
||||
|
||||
@@ -19,7 +19,6 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import forestry.api.genetics.IFruitBearer;
|
||||
import forestry.arboriculture.gadgets.TileFruitPod;
|
||||
import forestry.arboriculture.gadgets.TileSapling;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
public class EventHandlerArboriculture {
|
||||
@@ -32,12 +31,7 @@ public class EventHandlerArboriculture {
|
||||
}
|
||||
|
||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if (tile instanceof TileSapling) {
|
||||
int result = ((TileSapling) tile).tryGrow(true);
|
||||
if (result == 1 || result == 2) {
|
||||
event.setResult(Result.ALLOW);
|
||||
}
|
||||
} else if (tile instanceof TileFruitPod) {
|
||||
if (tile instanceof TileFruitPod) {
|
||||
if (((TileFruitPod) tile).canMature()) {
|
||||
((TileFruitPod) tile).mature();
|
||||
event.setResult(Result.ALLOW);
|
||||
|
||||
@@ -11,8 +11,10 @@
|
||||
package forestry.arboriculture.gadgets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -37,7 +39,7 @@ import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public class BlockSapling extends BlockTreeContainer {
|
||||
public class BlockSapling extends BlockTreeContainer implements IGrowable {
|
||||
|
||||
public static TileSapling getSaplingTile(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
@@ -186,4 +188,25 @@ public class BlockSapling extends BlockTreeContainer {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
/** canFertilize */
|
||||
public boolean func_149851_a(World worldIn, int x, int y, int z, boolean isClient) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
/** shouldFertilize */
|
||||
public boolean func_149852_a(World world, Random random, int x, int y, int z) {
|
||||
return (double) world.rand.nextFloat() < 0.45D;
|
||||
}
|
||||
|
||||
@Override
|
||||
/** fertilize */
|
||||
public void func_149853_b(World world, Random random, int x, int y, int z) {
|
||||
TileSapling saplingTile = getSaplingTile(world, x, y, z);
|
||||
if (saplingTile != null) {
|
||||
saplingTile.tryGrow(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.gadgets;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -53,7 +55,7 @@ import forestry.api.lepidopterology.IButterflyRoot;
|
||||
import forestry.arboriculture.network.PacketLeaf;
|
||||
import forestry.arboriculture.network.PacketRipeningUpdate;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.alleles.Allele;
|
||||
import forestry.core.network.ForestryPacket;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.TextureManager;
|
||||
@@ -490,11 +492,6 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
return zCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBiomeId() {
|
||||
return biome.biomeID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeGenBase getBiome() {
|
||||
return biome;
|
||||
@@ -511,18 +508,19 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorState(int state) {
|
||||
public boolean setErrorCondition(boolean condition, IErrorState errorState) {
|
||||
return condition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<IErrorState> getErrorStates() {
|
||||
return ImmutableSet.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorState(IErrorState state) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getErrorOrdinal() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumErrorCode getErrorState() {
|
||||
return null;
|
||||
|
||||
@@ -12,18 +12,18 @@ package forestry.arboriculture.genetics;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleFruit;
|
||||
import forestry.api.arboriculture.IFruitProvider;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.alleles.AlleleCategorized;
|
||||
|
||||
public class AlleleFruit extends Allele implements IAlleleFruit {
|
||||
public class AlleleFruit extends AlleleCategorized implements IAlleleFruit {
|
||||
|
||||
private final IFruitProvider provider;
|
||||
|
||||
public AlleleFruit(String uid, IFruitProvider provider) {
|
||||
this(uid, provider, false);
|
||||
public AlleleFruit(String name, IFruitProvider provider) {
|
||||
this(name, provider, false);
|
||||
}
|
||||
|
||||
public AlleleFruit(String uid, IFruitProvider provider, boolean isDominant) {
|
||||
super(uid, isDominant);
|
||||
public AlleleFruit(String name, IFruitProvider provider, boolean isDominant) {
|
||||
super("forestry", "fruit", name, isDominant);
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,18 +12,18 @@ package forestry.arboriculture.genetics;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleGrowth;
|
||||
import forestry.api.arboriculture.IGrowthProvider;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.alleles.AlleleCategorized;
|
||||
|
||||
public class AlleleGrowth extends Allele implements IAlleleGrowth {
|
||||
public class AlleleGrowth extends AlleleCategorized implements IAlleleGrowth {
|
||||
|
||||
private final IGrowthProvider provider;
|
||||
|
||||
public AlleleGrowth(String uid, IGrowthProvider provider) {
|
||||
this(uid, provider, false);
|
||||
public AlleleGrowth(String name, IGrowthProvider provider) {
|
||||
this(name, provider, false);
|
||||
}
|
||||
|
||||
public AlleleGrowth(String uid, IGrowthProvider provider, boolean isDominant) {
|
||||
super(uid, isDominant);
|
||||
public AlleleGrowth(String name, IGrowthProvider provider, boolean isDominant) {
|
||||
super("forestry", "growth", name, isDominant);
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,15 +16,15 @@ import net.minecraft.world.World;
|
||||
import forestry.api.arboriculture.IAlleleLeafEffect;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.alleles.AlleleCategorized;
|
||||
import forestry.core.vect.Vect;
|
||||
|
||||
public class AlleleLeafEffectNone extends Allele implements IAlleleLeafEffect {
|
||||
public class AlleleLeafEffectNone extends AlleleCategorized implements IAlleleLeafEffect {
|
||||
|
||||
private static final int[] DEFAULT_EFFECT_AREA = new int[]{12, 12, 12};
|
||||
|
||||
public AlleleLeafEffectNone(String uid) {
|
||||
super(uid, true);
|
||||
public AlleleLeafEffectNone() {
|
||||
super("forestry", "leaves", "none", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,7 +39,7 @@ public class AlleleLeafEffectNone extends Allele implements IAlleleLeafEffect {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "arboriculture.effect.none";
|
||||
return "for.arboriculture.effect.none";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,7 +47,7 @@ public class AlleleLeafEffectNone extends Allele implements IAlleleLeafEffect {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
protected AxisAlignedBB getBounding(int x, int y, int z, float modifier) {
|
||||
protected static AxisAlignedBB getBounding(int x, int y, int z, float modifier) {
|
||||
int[] areaAr = DEFAULT_EFFECT_AREA;
|
||||
Vect area = new Vect(areaAr[0], areaAr[1], areaAr[2]).multiply(modifier);
|
||||
Vect offset = new Vect(-Math.round(area.x / 2), -Math.round(area.y / 2), -Math.round(area.z / 2));
|
||||
|
||||
@@ -40,7 +40,7 @@ import forestry.api.world.ITreeGenData;
|
||||
import forestry.arboriculture.worldgen.WorldGenArboriculture;
|
||||
import forestry.arboriculture.worldgen.WorldGenBalsa;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.genetics.AlleleSpecies;
|
||||
import forestry.core.genetics.alleles.AlleleSpecies;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
@@ -86,14 +86,14 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci
|
||||
|
||||
private final ItemStack wood;
|
||||
|
||||
public AlleleTreeSpecies(String uid, boolean isDominant, String name, IClassification branch, String binomial, int primaryColor,
|
||||
public AlleleTreeSpecies(String uid, boolean isDominant, String speciesName, IClassification branch, String binomial, int primaryColor,
|
||||
Class<? extends WorldGenArboriculture> generator, ItemStack wood) {
|
||||
this(uid, isDominant, name, branch, binomial, primaryColor, Utils.multiplyRGBComponents(primaryColor, 1.35f), generator, wood);
|
||||
this(uid, isDominant, speciesName, branch, binomial, primaryColor, Utils.multiplyRGBComponents(primaryColor, 1.35f), generator, wood);
|
||||
}
|
||||
|
||||
public AlleleTreeSpecies(String uid, boolean isDominant, String name, IClassification branch, String binomial, int primaryColor, int secondaryColor,
|
||||
public AlleleTreeSpecies(String uid, boolean isDominant, String speciesName, IClassification branch, String binomial, int primaryColor, int secondaryColor,
|
||||
Class<? extends WorldGenArboriculture> generator, ItemStack wood) {
|
||||
super(uid, isDominant, "trees.species." + name, branch, binomial);
|
||||
super("forestry." + uid, "for.trees.species." + speciesName, "Sengir", "for.description." + uid, isDominant, branch, binomial, true);
|
||||
|
||||
this.root = (ITreeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees");
|
||||
this.generatorClass = generator;
|
||||
@@ -238,7 +238,8 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
if (vanillaMap < 0) {
|
||||
icon = TextureManager.getInstance().registerTex(register, "germlings/sapling." + uid);
|
||||
String name = uid.substring("forestry.".length());
|
||||
icon = TextureManager.getInstance().registerTex(register, "germlings/sapling." + name);
|
||||
} else {
|
||||
icon = Blocks.sapling.getIcon(0, vanillaMap);
|
||||
}
|
||||
|
||||
@@ -48,9 +48,9 @@ import forestry.arboriculture.gadgets.ForestryBlockLeaves;
|
||||
import forestry.arboriculture.gadgets.TileLeaves;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.Chromosome;
|
||||
import forestry.core.genetics.Individual;
|
||||
import forestry.core.genetics.alleles.Allele;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
|
||||
@@ -25,15 +25,12 @@ import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.arboriculture.IFruitProvider;
|
||||
import forestry.api.arboriculture.IGrowthProvider;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.AllelePlantType;
|
||||
import forestry.core.genetics.Chromosome;
|
||||
import forestry.core.genetics.Genome;
|
||||
import forestry.core.genetics.alleles.AllelePlantType;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public class TreeGenome extends Genome implements ITreeGenome {
|
||||
@@ -48,12 +45,7 @@ public class TreeGenome extends Genome implements ITreeGenome {
|
||||
|
||||
// NBT RETRIEVAL
|
||||
public static IAlleleTreeSpecies getSpecies(ItemStack itemStack) {
|
||||
IAllele speciesAllele = Genome.getActiveAllele(itemStack, EnumTreeChromosome.SPECIES);
|
||||
if (speciesAllele instanceof IAlleleTreeSpecies) {
|
||||
return (IAlleleTreeSpecies) speciesAllele;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return (IAlleleTreeSpecies) getActiveAllele(itemStack, EnumTreeChromosome.SPECIES, PluginArboriculture.treeInterface);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,51 +85,19 @@ public class TreeGenome extends Genome implements ITreeGenome {
|
||||
|
||||
@Override
|
||||
public float getSappiness() {
|
||||
// FIXME: Legacy handling.
|
||||
if (getChromosomes()[EnumTreeChromosome.SAPPINESS.ordinal()] == null) {
|
||||
getChromosomes()[EnumTreeChromosome.SAPPINESS.ordinal()] = new Chromosome(Allele.sappinessLowest);
|
||||
}
|
||||
|
||||
IAllele allele = getActiveAllele(EnumTreeChromosome.SAPPINESS);
|
||||
// FIXME: More legacy handling
|
||||
if (allele instanceof IAlleleFloat) {
|
||||
return ((IAlleleFloat) allele).getValue();
|
||||
} else {
|
||||
getChromosomes()[EnumTreeChromosome.SAPPINESS.ordinal()] = new Chromosome(Allele.sappinessLowest);
|
||||
return 0.1f;
|
||||
}
|
||||
return ((IAlleleFloat) getActiveAllele(EnumTreeChromosome.SAPPINESS)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<EnumPlantType> getPlantTypes() {
|
||||
// / FIXME: Needs some legacy handling.
|
||||
if (!(getActiveAllele(EnumTreeChromosome.PLANT) instanceof AllelePlantType)) {
|
||||
getChromosomes()[EnumTreeChromosome.PLANT.ordinal()] = new Chromosome(Allele.plantTypeNone);
|
||||
}
|
||||
|
||||
return ((AllelePlantType) getActiveAllele(EnumTreeChromosome.PLANT)).getPlantTypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaturationTime() {
|
||||
if (getChromosomes()[EnumTreeChromosome.MATURATION.ordinal()] == null) {
|
||||
getChromosomes()[EnumTreeChromosome.MATURATION.ordinal()] = new Chromosome(Allele.maturationSlowest);
|
||||
}
|
||||
|
||||
return ((IAlleleInteger) getActiveAllele(EnumTreeChromosome.MATURATION)).getValue();
|
||||
}
|
||||
|
||||
private IAllele translateGirth(int girth) {
|
||||
switch (girth) {
|
||||
case 2:
|
||||
return Allele.int2;
|
||||
case 3:
|
||||
return Allele.int3;
|
||||
default:
|
||||
return Allele.int1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGirth() {
|
||||
return ((IAlleleInteger) getActiveAllele(EnumTreeChromosome.GIRTH)).getValue();
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
package forestry.arboriculture.genetics;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.ITreeMutation;
|
||||
import forestry.api.arboriculture.ITreeRoot;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.core.genetics.Mutation;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
@@ -26,7 +26,7 @@ public class TreeMutation extends Mutation implements ITreeMutation {
|
||||
|
||||
private final ITreeRoot root;
|
||||
|
||||
public TreeMutation(IAllele allele0, IAllele allele1, IAllele[] template, int chance) {
|
||||
public TreeMutation(IAlleleSpecies allele0, IAlleleSpecies allele1, IAllele[] template, int chance) {
|
||||
super(allele0, allele1, template, chance);
|
||||
|
||||
root = (ITreeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees");
|
||||
@@ -40,22 +40,17 @@ public class TreeMutation extends Mutation implements ITreeMutation {
|
||||
|
||||
@Override
|
||||
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
float processedChance = chance;
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (biome.temperature < minTemperature || biome.temperature > maxTemperature) {
|
||||
return 0;
|
||||
}
|
||||
if (biome.rainfall < minRainfall || biome.rainfall > maxRainfall) {
|
||||
float processedChance = super.getChance(world, x, y, z, allele0, allele1, genome0, genome1);
|
||||
if (processedChance <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
processedChance *= PluginArboriculture.treeInterface.getTreekeepingMode(world).getMutationModifier((ITreeGenome) genome0, (ITreeGenome) genome1, 1f);
|
||||
|
||||
if (this.allele0.getUID().equals(allele0.getUID()) && this.allele1.getUID().equals(allele1.getUID())) {
|
||||
if (this.species0.getUID().equals(allele0.getUID()) && this.species1.getUID().equals(allele1.getUID())) {
|
||||
return processedChance;
|
||||
}
|
||||
if (this.allele1.getUID().equals(allele0.getUID()) && this.allele0.getUID().equals(allele1.getUID())) {
|
||||
if (this.species1.getUID().equals(allele0.getUID()) && this.species0.getUID().equals(allele1.getUID())) {
|
||||
return processedChance;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,9 @@ import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.Chromosome;
|
||||
import forestry.core.genetics.alleles.Allele;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
|
||||
public class TreeTemplates {
|
||||
|
||||
@@ -73,343 +74,343 @@ public class TreeTemplates {
|
||||
public static IAllele[] getDefaultTemplate() {
|
||||
IAllele[] alleles = new IAllele[EnumTreeChromosome.values().length];
|
||||
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeOak;
|
||||
alleles[EnumTreeChromosome.FRUITS.ordinal()] = Allele.fruitNone;
|
||||
alleles[EnumTreeChromosome.GROWTH.ordinal()] = Allele.growthLightlevel;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightSmall;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsLower;
|
||||
alleles[EnumTreeChromosome.YIELD.ordinal()] = Allele.yieldLowest;
|
||||
alleles[EnumTreeChromosome.PLANT.ordinal()] = Allele.plantTypeNone;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLowest;
|
||||
alleles[EnumTreeChromosome.TERRITORY.ordinal()] = Allele.territoryDefault;
|
||||
alleles[EnumTreeChromosome.EFFECT.ordinal()] = Allele.leavesNone;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationAverage;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int1;
|
||||
alleles[EnumTreeChromosome.FIREPROOF.ordinal()] = Allele.fireproofFalse;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeOak);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FRUITS, Allele.fruitNone);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.GROWTH, Allele.growthLightlevel);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.SMALL);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.YIELD, EnumAllele.Yield.LOWEST);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.PLANT, Allele.plantTypeNone);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWEST);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.TERRITORY, EnumAllele.Territory.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.EFFECT, Allele.leavesNone);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.GIRTH, 1);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FIREPROOF, EnumAllele.Fireproof.FALSE);
|
||||
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getOakTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.FRUITS.ordinal()] = Allele.fruitApple;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsAverage;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationFaster;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FRUITS, Allele.fruitApple);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.FASTER);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getBirchTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeBirch;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsAverage;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationFaster;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeBirch);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.FASTER);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getSpruceTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeSpruce;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsAverage;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightAverage;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationFaster;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeSpruce);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.FASTER);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getJungleTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeJungle;
|
||||
alleles[EnumTreeChromosome.FRUITS.ordinal()] = Allele.fruitCocoa;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightLarger;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationFast;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeJungle);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FRUITS, Allele.fruitCocoa);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.LARGER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.FAST);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getAcaciaTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeAcacia;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeAcacia);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getDarkOakTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeDarkOak;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsAverage;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationFaster;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int2;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeDarkOak);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.FASTER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.GIRTH, 2);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getBalsaTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeBalsa;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsHigh;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLower;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightLarge;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeBalsa);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.HIGH);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.LARGE);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getSequoiaTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeSequioa;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightLargest;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLower;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationSlower;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int3;
|
||||
alleles[EnumTreeChromosome.FIREPROOF.ordinal()] = Allele.fireproofTrue;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeSequioa);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.LARGEST);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.SLOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.GIRTH, 3);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FIREPROOF, EnumAllele.Fireproof.TRUE);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getGiganteumTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeGiganteum;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightGigantic;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLowest;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationSlowest;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int4;
|
||||
alleles[EnumTreeChromosome.FIREPROOF.ordinal()] = Allele.fireproofTrue;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeGiganteum);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.GIGANTIC);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWEST);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.SLOWEST);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.GIRTH, 4);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FIREPROOF, EnumAllele.Fireproof.TRUE);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getLarchTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeLarch;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsLow;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLower;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightAverage;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeLarch);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.AVERAGE);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getPineTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treePine;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsLow;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLower;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightAverage;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treePine);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.AVERAGE);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getCherryTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeCherry;
|
||||
alleles[EnumTreeChromosome.FRUITS.ordinal()] = Allele.fruitCherry;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsLow;
|
||||
alleles[EnumTreeChromosome.YIELD.ordinal()] = Allele.yieldAverage;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLow;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightSmaller;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeCherry);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FRUITS, Allele.fruitCherry);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.YIELD, EnumAllele.Yield.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.SMALLER);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getLimeTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeLime;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsLow;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLower;
|
||||
alleles[EnumTreeChromosome.YIELD.ordinal()] = Allele.yieldLower;
|
||||
//alleles[EnumTreeChromosome.EFFECT.ordinal()] = Allele.leavesBrimstone;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeLime);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.YIELD, EnumAllele.Yield.LOWER);
|
||||
//Allele.helper.set(alleles, EnumTreeChromosome.EFFECT, Allele.leavesBrimstone);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getTeakTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeTeak;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLower;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeTeak);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWER);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getKapokTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeKapok;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightLarge;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLow;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationSlow;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeKapok);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.LARGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.SLOW);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getEbonyTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeEbony;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightAverage;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLow;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationSlower;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int3;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeEbony);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.SLOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.GIRTH, 3);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getMahoganyTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeMahogany;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightLarge;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLow;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationSlow;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int2;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeMahogany);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.LARGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.SLOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.GIRTH, 2);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getChestnutTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeChestnut;
|
||||
alleles[EnumTreeChromosome.FRUITS.ordinal()] = Allele.fruitChestnut;
|
||||
alleles[EnumTreeChromosome.YIELD.ordinal()] = Allele.yieldAverage;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLower;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightLarge;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int2;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeChestnut);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FRUITS, Allele.fruitChestnut);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.YIELD, EnumAllele.Yield.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.LARGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.GIRTH, 2);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getDesertAcaciaTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeDesertAcacia;
|
||||
alleles[EnumTreeChromosome.PLANT.ordinal()] = Allele.plantTypeDesert;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeDesertAcacia);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.PLANT, Allele.plantTypeDesert);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getWengeTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeWenge;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsLowest;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int2;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeWenge);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.LOWEST);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.GIRTH, 2);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getBaobabTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeBaobab;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightLarge;
|
||||
alleles[EnumTreeChromosome.PLANT.ordinal()] = Allele.plantTypeDesert;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLower;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationSlow;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int3;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeBaobab);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.LARGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.PLANT, Allele.plantTypeDesert);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.SLOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.GIRTH, 3);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getWalnutTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeWalnut;
|
||||
alleles[EnumTreeChromosome.FRUITS.ordinal()] = Allele.fruitWalnut;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsLower;
|
||||
alleles[EnumTreeChromosome.YIELD.ordinal()] = Allele.yieldAverage;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLower;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightAverage;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int2;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeWalnut);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FRUITS, Allele.fruitWalnut);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.YIELD, EnumAllele.Yield.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.GIRTH, 2);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getWillowTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeWillow;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightAverage;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLow;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationFaster;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeWillow);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.FASTER);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getSipiriTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeSipiri;
|
||||
alleles[EnumTreeChromosome.GROWTH.ordinal()] = Allele.growthTropical;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightLarge;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLow;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationSlow;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeSipiri);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.GROWTH, Allele.growthTropical);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.LARGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.SLOW);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getMahoeTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeMahoe;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightSmall;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessHigh;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationSlowest;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeMahoe);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.SMALL);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.HIGH);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.SLOWEST);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getPoplarTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treePoplar;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightSmall;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLow;
|
||||
alleles[EnumTreeChromosome.MATURATION.ordinal()] = Allele.maturationSlower;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treePoplar);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.SMALL);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.MATURATION, EnumAllele.Maturation.SLOWER);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getLemonTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeLemon;
|
||||
alleles[EnumTreeChromosome.FRUITS.ordinal()] = Allele.fruitLemon;
|
||||
alleles[EnumTreeChromosome.YIELD.ordinal()] = Allele.yieldLower;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessAverage;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightSmallest;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeLemon);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FRUITS, Allele.fruitLemon);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.YIELD, EnumAllele.Yield.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.SMALLEST);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getPlumTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treePlum;
|
||||
alleles[EnumTreeChromosome.FRUITS.ordinal()] = Allele.fruitPlum;
|
||||
alleles[EnumTreeChromosome.YIELD.ordinal()] = Allele.yieldHigh;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessAverage;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightSmallest;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treePlum);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FRUITS, Allele.fruitPlum);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.YIELD, EnumAllele.Yield.HIGH);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.AVERAGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.SMALLEST);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getMapleTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeMaple;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsLow;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLower;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightAverage;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeMaple);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.AVERAGE);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getPapayaTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treePapaya;
|
||||
alleles[EnumTreeChromosome.FRUITS.ordinal()] = Allele.fruitPapaya;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsLow;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLower;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightAverage;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treePapaya);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FRUITS, Allele.fruitPapaya);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.AVERAGE);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getDateTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeDate;
|
||||
alleles[EnumTreeChromosome.FRUITS.ordinal()] = Allele.fruitDates;
|
||||
alleles[EnumTreeChromosome.FERTILITY.ordinal()] = Allele.saplingsLow;
|
||||
alleles[EnumTreeChromosome.YIELD.ordinal()] = Allele.yieldLow;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLow;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightAverage;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeDate);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FRUITS, Allele.fruitDates);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.FERTILITY, EnumAllele.Saplings.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.YIELD, EnumAllele.Yield.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOW);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.AVERAGE);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getIpeTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeIpe;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLower;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightLarge;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int2;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeIpe);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.LARGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.GIRTH, 2);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getPadaukTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treePadauk;
|
||||
alleles[EnumTreeChromosome.SAPPINESS.ordinal()] = Allele.sappinessLower;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightLarge;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treePadauk);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SAPPINESS, EnumAllele.Sappiness.LOWER);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.LARGE);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getCocoboloTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeCocobolo;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightLargest;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeCocobolo);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.LARGEST);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
public static IAllele[] getZebrawoodTemplate() {
|
||||
IAllele[] alleles = getDefaultTemplate();
|
||||
alleles[EnumTreeChromosome.SPECIES.ordinal()] = Allele.treeZebrawood;
|
||||
alleles[EnumTreeChromosome.HEIGHT.ordinal()] = Allele.heightLarge;
|
||||
alleles[EnumTreeChromosome.GIRTH.ordinal()] = Allele.int2;
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.SPECIES, Allele.treeZebrawood);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.HEIGHT, EnumAllele.Height.LARGE);
|
||||
Allele.helper.set(alleles, EnumTreeChromosome.GIRTH, 2);
|
||||
return alleles;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ 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.genetics.alleles.Allele;
|
||||
import forestry.core.genetics.alleles.AlleleBoolean;
|
||||
import forestry.core.genetics.alleles.AllelePlantType;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.gui.GuiAlyzer;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
@@ -16,7 +16,6 @@ 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.world.World;
|
||||
|
||||
@@ -32,6 +31,7 @@ import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.api.recipes.IVariableFermentable;
|
||||
import forestry.arboriculture.genetics.ICheckPollinatable;
|
||||
import forestry.arboriculture.genetics.Tree;
|
||||
import forestry.arboriculture.genetics.TreeGenome;
|
||||
import forestry.core.config.Config;
|
||||
@@ -39,6 +39,7 @@ import forestry.core.genetics.ItemGE;
|
||||
import forestry.core.network.PacketFXSignal;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.SpriteSheet;
|
||||
import forestry.core.utils.GeneticsUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
@@ -181,12 +182,18 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable {
|
||||
}
|
||||
} else if (type == EnumGermlingType.POLLEN) {
|
||||
|
||||
TileEntity target = world.getTileEntity(x, y, z);
|
||||
if (!(target instanceof IPollinatable)) {
|
||||
ICheckPollinatable checkPollinatable = GeneticsUtil.getCheckPollinatable(world, x, y, z);
|
||||
|
||||
if (checkPollinatable == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IPollinatable pollinatable = (IPollinatable) target;
|
||||
if (!checkPollinatable.canMateWith(tree)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IPollinatable pollinatable = GeneticsUtil.getOrCreatePollinatable(player.getGameProfile(), world, x, y, z);
|
||||
|
||||
if (!pollinatable.canMateWith(tree)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,9 +18,7 @@ import net.minecraft.world.World;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
import forestry.core.interfaces.IHintSource;
|
||||
import forestry.core.inventory.AlyzerInventory;
|
||||
import forestry.core.items.ItemInventoried;
|
||||
@@ -31,11 +29,10 @@ import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public class ItemTreealyzer extends ItemInventoried {
|
||||
|
||||
public static class TreealyzerInventory extends AlyzerInventory implements IErrorSource, IHintSource {
|
||||
public static class TreealyzerInventory extends AlyzerInventory implements IHintSource {
|
||||
|
||||
public TreealyzerInventory(EntityPlayer player, ItemStack itemStack) {
|
||||
super(ItemTreealyzer.class, 7, itemStack);
|
||||
this.player = player;
|
||||
super(player, 7, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,13 +41,6 @@ public class ItemTreealyzer extends ItemInventoried {
|
||||
}
|
||||
|
||||
private void tryAnalyze() {
|
||||
|
||||
// Analyzed slot occupied, abort
|
||||
if (inventoryStacks[SLOT_ANALYZE_1] != null || inventoryStacks[SLOT_ANALYZE_2] != null || inventoryStacks[SLOT_ANALYZE_3] != null
|
||||
|| inventoryStacks[SLOT_ANALYZE_4] != null || inventoryStacks[SLOT_ANALYZE_5] != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Source slot to analyze empty
|
||||
if (getStackInSlot(SLOT_SPECIMEN) == null) {
|
||||
return;
|
||||
@@ -95,8 +85,6 @@ public class ItemTreealyzer extends ItemInventoried {
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
// if (!Proxies.common.isSimulating(player.worldObj))
|
||||
// return;
|
||||
tryAnalyze();
|
||||
}
|
||||
|
||||
@@ -110,21 +98,6 @@ public class ItemTreealyzer extends ItemInventoried {
|
||||
public String[] getHints() {
|
||||
return Config.hints.get("treealyzer");
|
||||
}
|
||||
|
||||
// / IERRORSOURCE
|
||||
@Override
|
||||
public boolean throwsErrors() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumErrorCode getErrorState() {
|
||||
if (PluginArboriculture.treeInterface.isMember(inventoryStacks[SLOT_SPECIMEN]) && !isEnergy(getStackInSlot(SLOT_ENERGY))) {
|
||||
return EnumErrorCode.NOHONEY;
|
||||
}
|
||||
|
||||
return EnumErrorCode.OK;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemTreealyzer() {
|
||||
|
||||
@@ -4,19 +4,14 @@ import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.arboriculture.gadgets.TileTreeContainer;
|
||||
import forestry.core.network.ForestryPacket;
|
||||
import forestry.core.network.ILocatedPacket;
|
||||
import forestry.core.network.PacketCoordinates;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public class PacketTreeContainer extends ForestryPacket implements ILocatedPacket {
|
||||
public class PacketTreeContainer extends PacketCoordinates {
|
||||
|
||||
private int posX, posY, posZ;
|
||||
protected String speciesUID = "";
|
||||
|
||||
public PacketTreeContainer() {
|
||||
@@ -24,11 +19,7 @@ public class PacketTreeContainer extends ForestryPacket implements ILocatedPacke
|
||||
}
|
||||
|
||||
public PacketTreeContainer(int id, TileTreeContainer treeContainer) {
|
||||
super(id);
|
||||
|
||||
posX = treeContainer.xCoord;
|
||||
posY = treeContainer.yCoord;
|
||||
posZ = treeContainer.zCoord;
|
||||
super(id, treeContainer);
|
||||
|
||||
ITree tree = treeContainer.getTree();
|
||||
if (tree != null) {
|
||||
@@ -38,25 +29,16 @@ public class PacketTreeContainer extends ForestryPacket implements ILocatedPacke
|
||||
|
||||
@Override
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
data.writeShort(posX);
|
||||
data.writeShort(posY);
|
||||
data.writeShort(posZ);
|
||||
super.writeData(data);
|
||||
data.writeUTF(speciesUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStream data) throws IOException {
|
||||
posX = data.readShort();
|
||||
posY = data.readShort();
|
||||
posZ = data.readShort();
|
||||
super.readData(data);
|
||||
speciesUID = data.readUTF();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTarget(World world) {
|
||||
return world.getTileEntity(posX, posY, posZ);
|
||||
}
|
||||
|
||||
public boolean matchesTree(ITree tree) {
|
||||
if (tree == null) {
|
||||
return speciesUID.isEmpty();
|
||||
|
||||
@@ -144,7 +144,7 @@ public class LeavesRenderingHandler extends OverlayRenderingHandler implements I
|
||||
}
|
||||
}
|
||||
|
||||
private void renderItem(RenderBlocks renderer, ItemStack itemStack, float x, float y, float z) {
|
||||
private static void renderItem(RenderBlocks renderer, ItemStack itemStack, float x, float y, float z) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Block block = StackUtils.getBlock(itemStack);
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import forestry.core.config.Defaults;
|
||||
public enum EnumErrorCode implements IErrorState {
|
||||
|
||||
UNKNOWN("unknown"),
|
||||
@Deprecated // use no error code
|
||||
OK("ok"),
|
||||
INVALIDBIOME("invalidBiome"),
|
||||
ISRAINING("isRaining"),
|
||||
@@ -48,16 +49,21 @@ public enum EnumErrorCode implements IErrorState {
|
||||
NOSTAMPS("noStamps"),
|
||||
NOCIRCUITBOARD("noCircuitBoard"),
|
||||
NOCIRCUITLAYOUT("noCircuitLayout"),
|
||||
@Deprecated // wrong stack size is prevented in code
|
||||
WRONGSTACKSIZE("wrongStacksize"),
|
||||
NOFERTILIZER("noFertilizer"),
|
||||
NOFARMLAND("noFarmland"),
|
||||
CIRCUITMISMATCH("circuitMismatch"),
|
||||
NOLIQUID("noLiquid"),
|
||||
NOPAPER("noPaper"),
|
||||
@Deprecated // use two error codes instead: NOSTAMPS and NOPAPER
|
||||
NOSTAMPSNOPAPER("noStampsNoPaper", "noStamps"),
|
||||
NOSUPPLIES("noSupplies", "noResource"),
|
||||
NOTRADE("noTrade", "noResource"),
|
||||
NOPOWER("noPower");
|
||||
NOPOWER("noPower"),
|
||||
NOREDSTONE("noRedstone", "disabled"), // needs redstone signal
|
||||
DISABLED("disabledRedstone", "disabled") // disabled by redstone signal
|
||||
;
|
||||
|
||||
private final String name;
|
||||
private final String iconName;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class GuiHandler extends GuiHandlerBase {
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
return new GuiSolderingIron(player.inventory, new SolderingInventory(equipped));
|
||||
return new GuiSolderingIron(player, new SolderingInventory(player, equipped));
|
||||
|
||||
default:
|
||||
for (IGuiHandler handler : PluginManager.guiHandlers) {
|
||||
@@ -83,7 +83,7 @@ public class GuiHandler extends GuiHandlerBase {
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
return new ContainerSolderingIron(player.inventory, new SolderingInventory(equipped));
|
||||
return new ContainerSolderingIron(player, new SolderingInventory(player, equipped));
|
||||
|
||||
default:
|
||||
for (IGuiHandler handler : PluginManager.guiHandlers) {
|
||||
|
||||
Loaded 100 of 372 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user