Add factories for creating bee species and mutations

Remove strict bee biome check (it worked poorly with biome mods)
This commit is contained in:
mezz committed 2015-05-07 22:14:52 -07:00
1 parent d29f4c0b79
commit 6afee76bee
108 files changed
+2390 -1766

No files matched your search

@@ -16,6 +16,7 @@ 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;
@@ -217,7 +218,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);
@@ -283,8 +284,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();
@@ -296,7 +297,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--;
@@ -349,7 +350,7 @@ 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());
@@ -360,7 +361,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
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);
}
@@ -369,7 +370,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 {
@@ -176,6 +176,6 @@ public class GuiHandlerApiculture extends GuiHandlerBase {
}
private void synchApiaristTracker(World world, EntityPlayer player) {
PluginApiculture.beeInterface.getBreedingTracker(world, player.getGameProfile()).synchToPlayer(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
@@ -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();
@@ -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 {
@@ -190,9 +190,9 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
// / Multiplayer FX
ItemStack queenStack = inventory.getStackInSlot(SLOT_QUEEN);
if (PluginApiculture.beeInterface.isMated(queenStack)) {
if (BeeManager.beeRoot.isMated(queenStack)) {
if (getErrorState() == EnumErrorCode.OK && updateOnInterval(2)) {
IBee displayQueen = PluginApiculture.beeInterface.getMember(queenStack);
IBee displayQueen = BeeManager.beeRoot.getMember(queenStack);
displayQueen.doFX(beekeepingLogic.getEffectData(), this);
}
}
@@ -227,9 +227,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 +242,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;
@@ -266,9 +266,9 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
@Override
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
if (slotIndex == SLOT_QUEEN) {
return PluginApiculture.beeInterface.isMember(itemStack) && !PluginApiculture.beeInterface.isDrone(itemStack);
return BeeManager.beeRoot.isMember(itemStack) && !BeeManager.beeRoot.isDrone(itemStack);
} else if (slotIndex == SLOT_DRONE) {
return PluginApiculture.beeInterface.isDrone(itemStack);
return BeeManager.beeRoot.isDrone(itemStack);
}
return false;
}
@@ -284,7 +284,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
public void makeMaster() {
super.makeMaster();
if (beekeepingLogic == null) {
this.beekeepingLogic = PluginApiculture.beeInterface.createBeekeepingLogic(this);
this.beekeepingLogic = BeeManager.beeRoot.createBeekeepingLogic(this);
}
}
@@ -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 {
@@ -93,9 +92,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 +109,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;
}
@@ -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));
}
}
@@ -20,6 +20,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;
@@ -45,7 +46,6 @@ 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 {
@@ -57,11 +57,11 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
@Override
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
if (slotIndex == SLOT_QUEEN) {
return PluginApiculture.beeInterface.isMember(itemStack) && !PluginApiculture.beeInterface.isDrone(itemStack);
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 PluginApiculture.beeInterface.isDrone(itemStack);
return BeeManager.beeRoot.isDrone(itemStack);
}
return false;
}
@@ -86,7 +86,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());
}
@@ -158,9 +158,9 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised {
public void updateClientSide() {
// / Multiplayer FX
if (PluginApiculture.beeInterface.isMated(getInternalInventory().getStackInSlot(SLOT_QUEEN))) {
if (BeeManager.beeRoot.isMated(getInternalInventory().getStackInSlot(SLOT_QUEEN))) {
if (getErrorState() == EnumErrorCode.OK && updateOnInterval(2)) {
IBee displayQueen = PluginApiculture.beeInterface.getMember(getInternalInventory().getStackInSlot(SLOT_QUEEN));
IBee displayQueen = BeeManager.beeRoot.getMember(getInternalInventory().getStackInSlot(SLOT_QUEEN));
displayQueen.doFX(logic.getEffectData(), this);
}
}
@@ -213,7 +213,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 {
@@ -228,7 +228,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 {
@@ -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,61 +26,52 @@ 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.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;
import forestry.plugins.PluginApiculture;
public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies, IIconProvider {
public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpeciesCustom {
public IJubilanceProvider jubilanceProvider;
private final Map<ItemStack, Integer> products = new HashMap<ItemStack, Integer>();
private final Map<ItemStack, Integer> specialty = new HashMap<ItemStack, Integer>();
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;
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, false);
public AlleleBeeSpecies(String uid, String authority, String unlocalizedDescription, boolean dominant, String name, IClassification branch, String binomial, int primaryColor, int secondaryColor) {
super(uid, authority, unlocalizedDescription, dominant, name, branch, binomial, false);
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 PluginApiculture.beeInterface;
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, int chance) {
if (product == null || product.getItem() == null) {
throw new IllegalArgumentException("Tried to add null product");
}
@@ -87,16 +79,27 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
return this;
}
public AlleleBeeSpecies addSpecialty(ItemStack specialty, int chance) {
@Override
public IAlleleBeeSpeciesCustom addSpecialty(ItemStack specialty, int chance) {
if (specialty == null || specialty.getItem() == null) {
throw new IllegalArgumentException("Tried to add null specialty");
}
this.specialty.put(specialty, chance);
return this;
}
public AlleleBeeSpecies setJubilanceProvider(IJubilanceProvider provider) {
@Override
public IAlleleBeeSpeciesCustom setJubilanceProvider(IJubilanceProvider provider) {
this.jubilanceProvider = provider;
return this;
}
@Override
public IAlleleBeeSpeciesCustom setCustomBeeIconProvider(IBeeIconProvider beeIconProvider) {
this.beeIconProvider = beeIconProvider;
return this;
}
/* RESEARCH */
@Override
public int getComplexity() {
@@ -170,12 +173,12 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
}
@Override
public HashMap<ItemStack, Integer> getProducts() {
public Map<ItemStack, Integer> getProducts() {
return products;
}
@Override
public HashMap<ItemStack, Integer> getSpecialty() {
public Map<ItemStack, Integer> getSpecialty() {
return specialty;
}
@@ -185,8 +188,14 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
}
@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
@@ -200,45 +209,70 @@ 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() {
}
@SideOnly(Side.CLIENT)
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
@@ -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
@@ -14,13 +14,13 @@ 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.AlleleForestry;
import forestry.plugins.PluginApiculture;
public class AlleleEffectNone extends Allele implements IAlleleBeeEffect {
public class AlleleEffectNone extends AlleleForestry implements IAlleleBeeEffect {
public AlleleEffectNone(String uid) {
super(uid, true);
public AlleleEffectNone(String name) {
super("effect", name, true);
}
@Override
@@ -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
@@ -17,19 +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.AlleleForestry;
import forestry.core.vect.Vect;
import forestry.plugins.PluginApiculture;
public abstract class AlleleEffectThrottled extends Allele implements IAlleleBeeEffect {
public abstract class AlleleEffectThrottled extends AlleleForestry 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);
public AlleleEffectThrottled(String name, boolean isDominant, int throttle, boolean requiresWorking, boolean isCombinable) {
super("effect", name, isDominant);
this.name = "apiculture.effect." + name;
this.throttle = throttle;
this.isCombinable = isCombinable;
@@ -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.AlleleForestry;
public class AlleleFlowers extends Allele implements IAlleleFlowers {
public class AlleleFlowers extends AlleleForestry 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 category, String name, IFlowerProvider provider, boolean isDominant) {
super(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
@@ -24,6 +24,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;
@@ -42,7 +43,6 @@ 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 +57,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 {
@@ -408,7 +407,7 @@ public class Bee extends IndividualLiving implements IBee {
@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);
@@ -461,7 +460,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;
@@ -519,7 +518,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;
}
@@ -538,7 +537,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) {
@@ -585,42 +584,42 @@ 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;
IAllele allele0;
IAllele allele1;
IBeeGenome genome0;
IBeeGenome genome1;
IAlleleBeeSpecies allele0;
IAlleleBeeSpecies allele1;
if (world.rand.nextBoolean()) {
allele0 = parent1[EnumBeeChromosome.SPECIES.ordinal()].getPrimaryAllele();
allele1 = parent2[EnumBeeChromosome.SPECIES.ordinal()].getSecondaryAllele();
allele0 = (IAlleleBeeSpecies) parent1[EnumBeeChromosome.SPECIES.ordinal()].getPrimaryAllele();
allele1 = (IAlleleBeeSpecies) parent2[EnumBeeChromosome.SPECIES.ordinal()].getSecondaryAllele();
genome0 = genomeOne;
genome1 = genomeTwo;
} else {
allele0 = parent2[EnumBeeChromosome.SPECIES.ordinal()].getPrimaryAllele();
allele1 = parent1[EnumBeeChromosome.SPECIES.ordinal()].getSecondaryAllele();
allele0 = (IAlleleBeeSpecies) parent2[EnumBeeChromosome.SPECIES.ordinal()].getPrimaryAllele();
allele1 = (IAlleleBeeSpecies) parent1[EnumBeeChromosome.SPECIES.ordinal()].getSecondaryAllele();
genome0 = genomeTwo;
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());
}
}
@@ -2,9 +2,12 @@ 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.core.genetics.Allele;
import forestry.api.genetics.IClassification;
import forestry.core.genetics.alleles.Allele;
import forestry.core.genetics.alleles.EnumAllele;
public enum BeeBranchDefinition {
HONEY("Apis"),
@@ -14,104 +17,104 @@ public enum BeeBranchDefinition {
INFERNAL("Diapis") {
@Override
protected void setBranchProperties(IAllele[] alleles) {
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;
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) {
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;
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) {
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;
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) {
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;
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) {
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;
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) {
alleles[EnumBeeChromosome.TERRITORY.ordinal()] = Allele.territoryLargest;
alleles[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectRadioactive;
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) {
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;
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) {
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;
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) {
alleles[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowersMushrooms;
alleles[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.floweringSlower;
alleles[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceBoth1;
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) {
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;
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 BranchBees branch;
private final IClassification branch;
BeeBranchDefinition(String scientific) {
branch = new BranchBees(this.name().toLowerCase(), scientific);
branch = BeeManager.beeFactory.createBranch(this.name().toLowerCase(), scientific);
}
protected void setBranchProperties(IAllele[] template) {
@@ -124,7 +127,7 @@ public enum BeeBranchDefinition {
return template;
}
public final BranchBees getBranch() {
public final IClassification getBranch() {
return branch;
}
@@ -134,18 +137,18 @@ public enum BeeBranchDefinition {
if (defaultTemplate == null) {
defaultTemplate = new IAllele[EnumBeeChromosome.values().length];
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;
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, authority, unlocalizedDescription, dominant, unlocalizedName, branch, binomial, primaryColor, secondaryColor);
AlleleManager.alleleRegistry.registerAllele(species);
return species;
}
@Override
public IClassification createBranch(String uid, String scientific) {
return new BranchBees(uid, scientific);
}
}
@@ -13,6 +13,7 @@ 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;
@@ -24,12 +25,11 @@ 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 {
/**
@@ -72,7 +72,7 @@ public class BeeGenome extends Genome implements IBeeGenome {
// NBT RETRIEVAL
public static IAlleleBeeSpecies getSpecies(ItemStack itemStack) {
return (IAlleleBeeSpecies) getActiveAllele(itemStack, EnumBeeChromosome.SPECIES, PluginApiculture.beeInterface);
return (IAlleleBeeSpecies) getActiveAllele(itemStack, EnumBeeChromosome.SPECIES, BeeManager.beeRoot);
}
// / INFORMATION RETRIEVAL
@@ -149,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,7 +216,7 @@ 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);
}
@@ -10,110 +10,49 @@
******************************************************************************/
package forestry.apiculture.genetics;
import java.util.ArrayList;
import java.util.List;
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.IAllele;
import forestry.api.genetics.IGenome;
import forestry.core.genetics.Mutation;
import forestry.plugins.PluginApiculture;
public class BeeMutation extends Mutation implements IBeeMutation {
boolean requiresDay = false;
boolean requiresNight = false;
public class BeeMutation extends Mutation implements IBeeMutationCustom {
private final List<BiomeDictionary.Type> restrictBiomeTypes = new ArrayList<BiomeDictionary.Type>();
private boolean strictBiomeCheck = false;
public BeeMutation(BeeDefinition bee0, BeeDefinition bee1, BeeDefinition result, int chance) {
super(bee0.getGenome().getPrimary(), bee1.getGenome().getPrimary(), result.getTemplate(), chance);
public BeeMutation(IAlleleBeeSpecies bee0, IAlleleBeeSpecies bee1, IAllele[] result, int chance) {
super(bee0, bee1, result, chance);
}
@Override
public IBeeRoot getRoot() {
return PluginApiculture.beeInterface;
}
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()) {
int x = housing.getXCoord();
int y = housing.getYCoord();
int z = housing.getZCoord();
float processedChance = super.getChance(world, x, y, z, allele0, allele1, genome0, genome1);
if (processedChance <= 0) {
return 0;
}
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 = housing.getBiome();
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);
processedChance *= housing.getMutationModifier(genome0, genome1, 1f);
processedChance *= BeeManager.beeRoot.getBeekeepingMode(world).getMutationModifier(genome0, genome1, 1f);
if (processedChance <= 0) {
return 0;
}
@@ -1,19 +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.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 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;
}
}
@@ -2,13 +2,13 @@ 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.Allele;
import forestry.plugins.PluginApiculture;
import forestry.core.genetics.alleles.Allele;
public abstract class BeeVariation implements IBeeDefinition {
@@ -18,7 +18,7 @@ public abstract class BeeVariation implements IBeeDefinition {
public BeeVariation(IBeeDefinition bee) {
template = bee.getTemplate();
initializeTemplate(template);
genome = PluginApiculture.beeInterface.templateAsGenome(template);
genome = BeeManager.beeRoot.templateAsGenome(template);
}
protected abstract void initializeTemplate(IAllele[] template);
@@ -41,7 +41,7 @@ public abstract class BeeVariation implements IBeeDefinition {
@Override
public final ItemStack getMemberStack(EnumBeeType beeType) {
IBee bee = getIndividual();
return PluginApiculture.beeInterface.getMemberStack(bee, beeType.ordinal());
return BeeManager.beeRoot.getMemberStack(bee, beeType.ordinal());
}
public static class RainResist extends BeeVariation {
@@ -51,7 +51,7 @@ public abstract class BeeVariation implements IBeeDefinition {
@Override
protected void initializeTemplate(IAllele[] template) {
template[EnumBeeChromosome.TOLERANT_FLYER.ordinal()] = Allele.boolTrue;
Allele.helper.set(template, EnumBeeChromosome.TOLERANT_FLYER, true);
}
}
}
@@ -17,10 +17,10 @@ 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.plugins.PluginApiculture;
public class HiveDrop implements IHiveDrop {
@@ -48,7 +48,7 @@ public class HiveDrop implements IHiveDrop {
bee.setIsNatural(false);
}
return PluginApiculture.beeInterface.getMemberStack(bee, EnumBeeType.PRINCESS.ordinal());
return BeeManager.beeRoot.getMemberStack(bee, EnumBeeType.PRINCESS.ordinal());
}
@Override
@@ -16,12 +16,26 @@ 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 {
private static JubilanceDefault instance;
public static JubilanceDefault getInstance() {
if (instance == null) {
instance = new JubilanceDefault();
}
return instance;
}
protected JubilanceDefault() {
}
@Override
public boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing) {
BiomeGenBase biome = housing.getBiome();
@@ -1,24 +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 class JubilanceNone implements IJubilanceProvider {
@Override
public boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing) {
return false;
}
}
/*******************************************************************************
* 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);
}
}
@@ -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,101 +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(BeeDefinition bee0, BeeDefinition bee1, BeeDefinition result, int chance, ItemStack blockRequired, Class<?> condenserClass, Field emcField, int emcRequired) {
super(bee0, bee1, result, 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(BeeDefinition bee0, BeeDefinition bee1, BeeDefinition result, int chance, ItemStack blockRequired) {
super(bee0, bee1, result, 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,154 +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;
protected MutationTimeLimited(BeeDefinition bee0, BeeDefinition bee1, BeeDefinition result, int chance, DayMonth start, DayMonth end) {
super(bee0, bee1, result, 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;
}
}
@@ -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;
}
@@ -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,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.IBee;
import forestry.api.core.ForestryAPI;
import forestry.api.core.Tabs;
@@ -26,7 +27,6 @@ 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 {
@@ -39,7 +39,7 @@ public class ItemBeealyzer extends ItemInventoried {
@Override
protected boolean isSpecimen(ItemStack itemStack) {
return PluginApiculture.beeInterface.isMember(itemStack);
return BeeManager.beeRoot.isMember(itemStack);
}
private void tryAnalyze() {
@@ -48,7 +48,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 +64,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();
@@ -104,7 +104,7 @@ public class ItemBeealyzer extends ItemInventoried {
@Override
public EnumErrorCode getErrorState() {
if (PluginApiculture.beeInterface.isMember(inventoryStacks[SLOT_SPECIMEN]) && !isEnergy(getStackInSlot(SLOT_ENERGY))) {
if (BeeManager.beeRoot.isMember(inventoryStacks[SLOT_SPECIMEN]) && !isEnergy(getStackInSlot(SLOT_ENERGY))) {
return EnumErrorCode.NOHONEY;
}
@@ -32,6 +32,7 @@ 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;
@@ -50,7 +51,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 {
@@ -91,7 +91,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) {
@@ -126,7 +126,7 @@ public class ItemHabitatLocator extends ItemInventoried {
@Override
public EnumErrorCode getErrorState() {
if (PluginApiculture.beeInterface.isMember(inventoryStacks[SLOT_SPECIMEN]) && !isEnergy(getStackInSlot(SLOT_ENERGY))) {
if (BeeManager.beeRoot.isMember(inventoryStacks[SLOT_SPECIMEN]) && !isEnergy(getStackInSlot(SLOT_ENERGY))) {
return EnumErrorCode.NOHONEY;
}
@@ -139,7 +139,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,7 +25,6 @@ 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 {
@@ -44,7 +44,7 @@ public class ItemImprinter extends ItemForestry {
}
public void advancePrimary() {
if (primaryIndex < PluginApiculture.beeInterface.getIndividualTemplates().size() - 1) {
if (primaryIndex < BeeManager.beeRoot.getIndividualTemplates().size() - 1) {
primaryIndex++;
} else {
primaryIndex = 0;
@@ -52,7 +52,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 +63,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 +71,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() {
@@ -112,7 +112,7 @@ public class ItemImprinter extends ItemForestry {
}
// Only imprint bees
if (!PluginApiculture.beeInterface.isMember(inventoryStacks[specimenSlot])) {
if (!BeeManager.beeRoot.isMember(inventoryStacks[specimenSlot])) {
return;
}
@@ -146,7 +146,7 @@ public class ItemImprinter extends ItemForestry {
@Override
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
return PluginApiculture.beeInterface.isMember(itemStack);
return BeeManager.beeRoot.isMember(itemStack);
}
}
@@ -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());
@@ -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) {
@@ -53,7 +53,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;
@@ -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.AlleleForestry;
public class AlleleFruit extends Allele implements IAlleleFruit {
public class AlleleFruit extends AlleleForestry 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("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.AlleleForestry;
public class AlleleGrowth extends Allele implements IAlleleGrowth {
public class AlleleGrowth extends AlleleForestry 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("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.AlleleForestry;
import forestry.core.vect.Vect;
public class AlleleLeafEffectNone extends Allele implements IAlleleLeafEffect {
public class AlleleLeafEffectNone extends AlleleForestry implements IAlleleLeafEffect {
private static final int[] DEFAULT_EFFECT_AREA = new int[]{12, 12, 12};
public AlleleLeafEffectNone(String uid) {
super(uid, true);
public AlleleLeafEffectNone() {
super("leaves", "none", true);
}
@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;
@@ -93,7 +93,7 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci
public AlleleTreeSpecies(String uid, boolean isDominant, String name, IClassification branch, String binomial, int primaryColor, int secondaryColor,
Class<? extends WorldGenArboriculture> generator, ItemStack wood) {
super(uid, isDominant, "trees.species." + name, branch, binomial, true);
super("forestry." + uid, "Sengir", "for.description." + uid, isDominant, "trees.species." + name, 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;
@@ -29,8 +29,8 @@ import forestry.api.genetics.IAlleleFloat;
import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.IChromosome;
import forestry.api.genetics.ISpeciesRoot;
import forestry.core.genetics.AllelePlantType;
import forestry.core.genetics.Genome;
import forestry.core.genetics.alleles.AllelePlantType;
import forestry.plugins.PluginArboriculture;
public class TreeGenome extends Genome implements ITreeGenome {
@@ -11,7 +11,6 @@
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;
@@ -41,13 +40,8 @@ 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;
}
@@ -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;
@@ -127,11 +127,6 @@ public class Defaults {
public static final int SLOTS_BACKPACK_T2 = 45;
public static final int SLOTS_BACKPACK_APIARIST = 125;
// Bee ids
public static final int ID_BEE_SPECIES_REDDENED = 31;
public static final int ID_BEE_SPECIES_DARKENED = 32;
public static final int ID_BEE_SPECIES_OMEGA = 33;
// Food stuff
public static final int FOOD_AMBROSIA_HEAL = 8;
public static final int FOOD_JUICE_HEAL = 2;
@@ -23,6 +23,7 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import forestry.api.apiculture.BeeManager;
import forestry.api.core.ForestryAPI;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
@@ -43,7 +44,6 @@ import forestry.core.network.GuiId;
import forestry.core.network.PacketPayload;
import forestry.core.utils.GeneticsUtil;
import forestry.core.utils.GuiUtil;
import forestry.plugins.PluginApiculture;
public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiquidTankContainer {
@@ -211,7 +211,7 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
}
IIndividual displayIndividual = AlleleManager.alleleRegistry.getIndividual(displayStack);
int type = PluginApiculture.beeInterface.getType(displayStack).ordinal();
int type = BeeManager.beeRoot.getType(displayStack).ordinal();
PacketPayload payload = new PacketPayload();
payload.stringPayload = new String[1];
@@ -229,10 +229,10 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
int type = payload.shortPayload[0];
int stackSize = payload.shortPayload[1];
IAllele[] template = PluginApiculture.beeInterface.getTemplate(individualUID);
IIndividual individual = PluginApiculture.beeInterface.templateAsIndividual(template);
IAllele[] template = BeeManager.beeRoot.getTemplate(individualUID);
IIndividual individual = BeeManager.beeRoot.templateAsIndividual(template);
newIndividualOnDisplay = PluginApiculture.beeInterface.getMemberStack(individual, type);
newIndividualOnDisplay = BeeManager.beeRoot.getMemberStack(individual, type);
newIndividualOnDisplay.stackSize = stackSize;
}
@@ -26,7 +26,6 @@ import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.ISpeciesRoot;
import forestry.core.config.Config;
import forestry.core.proxy.Proxies;
public abstract class Genome implements IGenome {
@@ -93,7 +92,7 @@ public abstract class Genome implements IGenome {
}
if (chromosome.hasInvalidAlleles(speciesRoot.getKaryotype()[chromosomeOrdinal].getAlleleClass())) {
throw new RuntimeException("Found Chromosome with invalid Alleles.\nNBTTagCompound: " + chromosomesNBT + "\nSee config option \"genetics.clear.invalid.chromosomes\".");
throw new RuntimeException("Found Chromosome with invalid Alleles.\nNBTTagCompound: " + chromosomesNBT + "\nSee config option \"genetics.clear.invalid.chromosomes\".\nMissing: " + chromosomeNBT);
}
}
}
@@ -12,16 +12,24 @@ package forestry.core.genetics;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraftforge.common.BiomeDictionary;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IMutation;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
import forestry.api.genetics.IMutationCustom;
public abstract class Mutation implements IMutation {
public abstract class Mutation implements IMutationCustom {
protected final int chance;
private final int chance;
boolean isSecret = false;
protected final IAllele species0;
@@ -29,12 +37,8 @@ public abstract class Mutation implements IMutation {
private final IAllele[] template;
protected float minTemperature = 0.0f;
protected float maxTemperature = 2.0f;
protected float minRainfall = 0.0f;
protected float maxRainfall = 2.0f;
protected final ArrayList<String> specialConditions = new ArrayList<String>();
private final List<IMutationCondition> mutationConditions = new ArrayList<IMutationCondition>();
private final List<String> specialConditions = new ArrayList<String>();
public Mutation(IAlleleSpecies species0, IAlleleSpecies species1, IAllele[] template, int chance) {
this.species0 = species0;
@@ -43,54 +47,84 @@ public abstract class Mutation implements IMutation {
this.chance = chance;
}
public Mutation setSpecialConditions(Collection<String> conditions) {
specialConditions.addAll(conditions);
return this;
}
public Collection<String> getSpecialConditions() {
return specialConditions;
}
@Override
public Mutation setIsSecret() {
isSecret = true;
return this;
}
public Mutation setTemperature(float minTemperature, float maxTemperature) {
this.minTemperature = minTemperature;
this.maxTemperature = maxTemperature;
EnumTemperature temp1 = EnumTemperature.getFromValue(minTemperature);
EnumTemperature temp2 = EnumTemperature.getFromValue(maxTemperature);
if (temp1 != temp2) {
specialConditions.add(String.format("Temperature between %s and %s.", temp1, temp2));
} else {
specialConditions.add(String.format("Temperature %s required.", temp1));
}
@Override
public Mutation restrictTemperature(EnumTemperature temperature) {
return restrictTemperature(temperature, temperature);
}
@Override
public Mutation restrictTemperature(EnumTemperature minTemperature, EnumTemperature maxTemperature) {
IMutationCondition mutationCondition = new MutationConditionTemperature(minTemperature, maxTemperature);
return addMutationCondition(mutationCondition);
}
@Override
public Mutation restrictHumidity(EnumHumidity humidity) {
return restrictHumidity(humidity, humidity);
}
@Override
public Mutation restrictHumidity(EnumHumidity minHumidity, EnumHumidity maxHumidity) {
IMutationCondition mutationCondition = new MutationConditionHumidity(minHumidity, maxHumidity);
return addMutationCondition(mutationCondition);
}
@Override
public Mutation restrictBiomeType(BiomeDictionary.Type... types) {
IMutationCondition mutationCondition = new MutationConditionBiome(types);
return addMutationCondition(mutationCondition);
}
@Override
public Mutation requireDay() {
IMutationCondition mutationCondition = new MutationConditionDaytime(true);
return addMutationCondition(mutationCondition);
}
@Override
public Mutation requireNight() {
IMutationCondition mutationCondition = new MutationConditionDaytime(false);
return addMutationCondition(mutationCondition);
}
@Override
public Mutation restrictDateRange(int startMonth, int startDay, int endMonth, int endDay) {
IMutationCondition mutationCondition = new MutationConditionTimeLimited(startMonth, startDay, endMonth, endDay);
return addMutationCondition(mutationCondition);
}
@Override
public Mutation requireResource(Block block, int meta) {
IMutationCondition mutationCondition = new MutationConditionRequiresResource(block, meta);
return addMutationCondition(mutationCondition);
}
@Override
public Mutation addMutationCondition(IMutationCondition mutationCondition) {
mutationConditions.add(mutationCondition);
specialConditions.add(mutationCondition.getDescription());
return this;
}
public Mutation setRainfall(float minRainfall, float maxRainfall) {
this.minRainfall = minRainfall;
this.maxRainfall = maxRainfall;
EnumHumidity temp1 = EnumHumidity.getFromValue(minRainfall);
EnumHumidity temp2 = EnumHumidity.getFromValue(maxRainfall);
if (temp1 != temp2) {
specialConditions.add(String.format("Humidity between %s and %s.", temp1, temp2));
} else {
specialConditions.add(String.format("Humidity %s required.", temp1));
protected float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
float mutationChance = chance;
for (IMutationCondition mutationCondition : mutationConditions) {
mutationChance *= mutationCondition.getChance(world, x, y, z, allele0, allele1, genome0, genome1);
if (mutationChance == 0) {
return 0;
}
}
return this;
}
public Mutation setTemperatureRainfall(float minTemperature, float maxTemperature, float minRainfall, float maxRainfall) {
setTemperature(minTemperature, maxTemperature);
setRainfall(minRainfall, maxRainfall);
return this;
return mutationChance;
}
@Override
@@ -0,0 +1,55 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
import java.util.Arrays;
import java.util.List;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
public class MutationConditionBiome implements IMutationCondition {
private final List<BiomeDictionary.Type> validBiomeTypes;
public MutationConditionBiome(BiomeDictionary.Type... types) {
this.validBiomeTypes = Arrays.asList(types);
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
for (BiomeDictionary.Type type : validBiomeTypes) {
if (BiomeDictionary.isBiomeOfType(biome, type)) {
return 1;
}
}
return 0;
}
@Override
public String getDescription() {
if (validBiomeTypes.size() > 1) {
String biomeTypes = Arrays.toString(validBiomeTypes.toArray());
return String.format("Is restricted to biomes like: %s", biomeTypes);
} else {
String biomeType = validBiomeTypes.get(0).toString();
return String.format("Is restricted to %s-like biomes.", biomeType);
}
}
}
@@ -0,0 +1,43 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
import net.minecraft.world.World;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
public class MutationConditionDaytime implements IMutationCondition {
private final boolean daytime;
public MutationConditionDaytime(boolean daytime) {
this.daytime = daytime;
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
if (world.isDaytime() == daytime) {
return 1;
}
return 0;
}
@Override
public String getDescription() {
if (daytime) {
return "Can only occur during the day.";
} else {
return "Can only occur during the night.";
}
}
}
@@ -0,0 +1,49 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import forestry.api.core.EnumHumidity;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
public class MutationConditionHumidity implements IMutationCondition {
private final EnumHumidity minHumidity;
private final EnumHumidity maxHumidity;
public MutationConditionHumidity(EnumHumidity minHumidity, EnumHumidity maxHumidity) {
this.minHumidity = minHumidity;
this.maxHumidity = maxHumidity;
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
EnumHumidity biomeHumidity = EnumHumidity.getFromValue(biome.rainfall);
if (biomeHumidity.ordinal() < minHumidity.ordinal() || biomeHumidity.ordinal() > maxHumidity.ordinal()) {
return 0;
}
return 1;
}
@Override
public String getDescription() {
if (minHumidity != maxHumidity) {
return String.format("Humidity between %s and %s.", minHumidity, maxHumidity);
} else {
return String.format("Humidity %s required.", minHumidity);
}
}
}
@@ -0,0 +1,41 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
import forestry.core.utils.StackUtils;
public class MutationConditionRequiresResource implements IMutationCondition {
private final ItemStack blockRequired;
public MutationConditionRequiresResource(Block block, int meta) {
blockRequired = new ItemStack(block, meta);
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
Block block = world.getBlock(x, y - 1, z);
int meta = world.getBlockMetadata(x, y - 1, z);
return StackUtils.equals(block, meta, blockRequired) ? 1 : 0;
}
@Override
public String getDescription() {
return String.format("Must be placed on:%s", blockRequired.getDisplayName());
}
}
@@ -0,0 +1,50 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import forestry.api.core.EnumTemperature;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
public class MutationConditionTemperature implements IMutationCondition {
private final EnumTemperature minTemperature;
private final EnumTemperature maxTemperature;
public MutationConditionTemperature(EnumTemperature minTemperature, EnumTemperature maxTemperature) {
this.minTemperature = minTemperature;
this.maxTemperature = maxTemperature;
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
EnumTemperature biomeTemperature = EnumTemperature.getFromBiome(biome);
if (biomeTemperature.ordinal() < minTemperature.ordinal() || biomeTemperature.ordinal() > maxTemperature.ordinal()) {
return 0;
}
return 1;
}
@Override
public String getDescription() {
if (minTemperature != maxTemperature) {
return String.format("Temperature between %s and %s.", minTemperature, maxTemperature);
} else {
return String.format("Temperature %s required.", minTemperature);
}
}
}
@@ -0,0 +1,59 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
import java.util.Calendar;
import net.minecraft.world.World;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
import forestry.core.utils.DayMonth;
public class MutationConditionTimeLimited implements IMutationCondition {
private final DayMonth start;
private final DayMonth end;
public MutationConditionTimeLimited(int startMonth, int startDay, int endMonth, int endDay) {
this.start = new DayMonth(startDay, startMonth);
this.end = new DayMonth(endDay, endMonth);
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
DayMonth now = new DayMonth();
// If we are equal to start day, return 1.
if (Calendar.getInstance().get(Calendar.DAY_OF_MONTH) == start.day && Calendar.getInstance().get(Calendar.MONTH) + 1 == start.month) {
return 1;
}
// Equal to end date, return 1
if (Calendar.getInstance().get(Calendar.DAY_OF_MONTH) == end.day && Calendar.getInstance().get(Calendar.MONTH) + 1 == end.month) {
return 1;
}
// Still a chance we are in between
if (now.between(start, end)) {
return 1;
}
// Now we finally failed.
return 0;
}
@Override
public String getDescription() {
return "Between " + start + " and " + end + '.';
}
}
@@ -8,7 +8,7 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
package forestry.core.genetics.alleles;
import java.util.EnumSet;
@@ -18,23 +18,17 @@ import forestry.api.arboriculture.IAlleleFruit;
import forestry.api.arboriculture.IAlleleGrowth;
import forestry.api.arboriculture.IAlleleTreeSpecies;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.EnumTolerance;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.ILegacyHandler;
import forestry.api.lepidopterology.IAlleleButterflySpecies;
import forestry.core.config.Defaults;
import forestry.core.utils.StringUtil;
public class Allele implements IAllele {
public abstract class Allele implements IAllele {
protected final String uid;
protected final boolean isDominant;
protected String name;
public Allele(String uid, boolean isDominant) {
this(uid, isDominant, false);
}
protected Allele(String uid, boolean isDominant, boolean skipRegister) {
this.uid = uid;
this.isDominant = isDominant;
@@ -47,7 +41,7 @@ public class Allele implements IAllele {
@Override
public String getUID() {
return "forestry." + this.uid;
return uid;
}
@Override
@@ -55,6 +49,8 @@ public class Allele implements IAllele {
return isDominant;
}
public static IAlleleHelper helper;
// / TREES // SPECIES 512 - 1023
public static IAlleleTreeSpecies treeOak;
public static IAlleleTreeSpecies treeBirch;
@@ -141,47 +137,6 @@ public class Allele implements IAllele {
public static IAlleleButterflySpecies lepiSpicebush;
public static IAlleleButterflySpecies lepiMalachite;
public static IAlleleButterflySpecies lepiLLacewing;
// / ALL // GENERIC
public static final Allele boolFalse = new AlleleBoolean("boolFalse", false);
public static final Allele boolTrue = new AlleleBoolean("boolTrue", true);
public static final Allele int1 = new AlleleInteger("i1d", 1, true);
public static final Allele int2 = new AlleleInteger("i2d", 2, true);
public static final Allele int3 = new AlleleInteger("i3d", 3, true);
public static final Allele int4 = new AlleleInteger("i4d", 4, true);
public static final Allele int5 = new AlleleInteger("i5d", 5, true);
public static final Allele int6 = new AlleleInteger("i6d", 6, true);
public static final Allele int7 = new AlleleInteger("i7d", 7, true);
public static final Allele int8 = new AlleleInteger("i8d", 8, true);
public static final Allele int9 = new AlleleInteger("i9d", 9, true);
public static final Allele int10 = new AlleleInteger("i10d", 10, true);
// / BEES // SPEED 1100 - 1199
public static final Allele speedSlowest = new AlleleFloat("speedSlowest", 0.3f, true).setName("speed", "slowest");
public static final Allele speedSlower = new AlleleFloat("speedSlower", 0.6f, true).setName("speed", "slower");
public static final Allele speedSlow = new AlleleFloat("speedSlow", 0.8f, true).setName("speed", "slow");
public static final Allele speedNorm = new AlleleFloat("speedNorm", 1.0f).setName("speed", "normal");
public static final Allele speedFast = new AlleleFloat("speedFast", 1.2f, true).setName("speed", "fast");
public static final Allele speedFaster = new AlleleFloat("speedFaster", 1.4f).setName("speed", "faster");
public static final Allele speedFastest = new AlleleFloat("speedFastest", 1.7f).setName("speed", "fastest");
// / BEES // LIFESPAN 1200 - 1299
public static final Allele lifespanShortest = new AlleleInteger("lifespanShortest", 10, false).setName("gui.shortestlife");
public static final Allele lifespanShorter = new AlleleInteger("lifespanShorter", 20, true).setName("gui.shorterlife");
public static final Allele lifespanShort = new AlleleInteger("lifespanShort", 30, true).setName("gui.shortlife");
public static final Allele lifespanShortened = new AlleleInteger("lifespanShortened", 35, true).setName("gui.shortenedlife");
public static final Allele lifespanNormal = new AlleleInteger("lifespanNormal", 40).setName("gui.normallife");
public static final Allele lifespanElongated = new AlleleInteger("lifespanElongated", 45, true).setName("gui.elongatedlife");
public static final Allele lifespanLong = new AlleleInteger("lifespanLong", 50).setName("gui.longlife");
public static final Allele lifespanLonger = new AlleleInteger("lifespanLonger", 60).setName("gui.longerlife");
public static final Allele lifespanLongest = new AlleleInteger("lifespanLongest", 70).setName("gui.longestlife");
// / BEES // FERTILITY 1300 - 1349
public static final Allele fertilityLow = new AlleleInteger("fertilityLow", 1, true);
public static final Allele fertilityNormal = new AlleleInteger("fertilityNormal", 2, true);
public static final Allele fertilityHigh = new AlleleInteger("fertilityHigh", 3);
public static final Allele fertilityMaximum = new AlleleInteger("fertilityMaximum", 4);
// / TREES // GROWTH PROVIDER 1350 - 1399
public static IAlleleGrowth growthLightlevel;
@@ -202,106 +157,6 @@ public class Allele implements IAllele {
public static IAlleleFruit fruitPlum;
public static IAlleleFruit fruitJujube;
// / TREES // HEIGHT 1400 - 1449
public static final Allele heightSmallest = new AlleleFloat("heightSmallest", 0.25f).setName("height", "smallest");
public static final Allele heightSmaller = new AlleleFloat("heightSmaller", 0.5f).setName("height", "smaller");
public static final Allele heightSmall = new AlleleFloat("heightSmall", 0.75f).setName("height", "small");
public static final Allele heightAverage = new AlleleFloat("heightMax10", 1.0f).setName("height", "average");
public static final Allele heightLarge = new AlleleFloat("heightLarge", 1.25f).setName("height", "large");
public static final Allele heightLarger = new AlleleFloat("heightLarger", 1.5f).setName("height", "larger");
public static final Allele heightLargest = new AlleleFloat("heightLargest", 1.75f).setName("height", "largest");
public static final Allele heightGigantic = new AlleleFloat("heightGigantic", 2.0f).setName("height", "gigantic");
/// BUTTERFLIES // SIZE
public static final Allele sizeSmallest = new AlleleFloat("sizeSmallest", 0.3f).setName("size", "smallest");
public static final Allele sizeSmaller = new AlleleFloat("sizeSmaller", 0.4f).setName("size", "smaller");
public static final Allele sizeSmall = new AlleleFloat("sizeSmall", 0.5f).setName("size", "small");
public static final Allele sizeAverage = new AlleleFloat("sizeAverage", 0.6f).setName("size", "average");
public static final Allele sizeLarge = new AlleleFloat("sizeLarge", 0.75f).setName("size", "large");
public static final Allele sizeLarger = new AlleleFloat("sizeLarger", 0.9f).setName("size", "larger");
public static final Allele sizeLargest = new AlleleFloat("sizeLargest", 1.0f).setName("size", "largest");
// / BOTH // TOLERANCE 1450 - 1499
public static final Allele toleranceNone = new AlleleTolerance("toleranceNone", EnumTolerance.NONE);
public static final Allele toleranceBoth1 = new AlleleTolerance("toleranceBoth1", EnumTolerance.BOTH_1, true);
public static final Allele toleranceBoth2 = new AlleleTolerance("toleranceBoth2", EnumTolerance.BOTH_2);
public static final Allele toleranceBoth3 = new AlleleTolerance("toleranceBoth3", EnumTolerance.BOTH_3);
public static final Allele toleranceBoth4 = new AlleleTolerance("toleranceBoth4", EnumTolerance.BOTH_4);
public static final Allele toleranceBoth5 = new AlleleTolerance("toleranceBoth5", EnumTolerance.BOTH_5);
public static final Allele toleranceUp1 = new AlleleTolerance("toleranceUp1", EnumTolerance.UP_1, true);
public static final Allele toleranceUp2 = new AlleleTolerance("toleranceUp2", EnumTolerance.UP_2);
public static final Allele toleranceUp3 = new AlleleTolerance("toleranceUp3", EnumTolerance.UP_3);
public static final Allele toleranceUp4 = new AlleleTolerance("toleranceUp4", EnumTolerance.UP_4);
public static final Allele toleranceUp5 = new AlleleTolerance("toleranceUp5", EnumTolerance.UP_5);
public static final Allele toleranceDown1 = new AlleleTolerance("toleranceDown1", EnumTolerance.DOWN_1, true);
public static final Allele toleranceDown2 = new AlleleTolerance("toleranceDown2", EnumTolerance.DOWN_2);
public static final Allele toleranceDown3 = new AlleleTolerance("toleranceDown3", EnumTolerance.DOWN_3);
public static final Allele toleranceDown4 = new AlleleTolerance("toleranceDown4", EnumTolerance.DOWN_4);
public static final Allele toleranceDown5 = new AlleleTolerance("toleranceDown5", EnumTolerance.DOWN_5);
// / BEES // FLOWER PROVIDERS 1500 - 1599
public static Allele flowersVanilla;
public static Allele flowersNether;
public static Allele flowersCacti;
public static Allele flowersMushrooms;
public static Allele flowersEnd;
public static Allele flowersJungle;
public static Allele flowersSnow;
public static Allele flowersWheat;
public static Allele flowersGourd;
// / TREES // FERTILITY 1600 - 1649
public static final Allele saplingsLowest = new AlleleFloat("saplingsLowest", 0.01f, true).setName("saplings", "lowest");
public static final Allele saplingsLower = new AlleleFloat("saplingsLower", 0.025f, true).setName("saplings", "lower");
public static final Allele saplingsLow = new AlleleFloat("saplingsLow", 0.035f, true).setName("saplings", "low");
public static final Allele saplingsAverage = new AlleleFloat("saplingsDefault", 0.05f, true).setName("saplings", "average");
public static final Allele saplingsHigh = new AlleleFloat("saplingsDouble", 0.1f, true).setName("saplings", "high");
public static final Allele saplingsHigher = new AlleleFloat("saplingsTriple", 0.2f, true).setName("saplings", "higher");
public static final Allele saplingsHighest = new AlleleFloat("saplingsHighest", 0.3f, true).setName("saplings", "highest");
// / TREES // YIELD 1650 - 1699
public static final Allele yieldLowest = new AlleleFloat("yieldLowest", 0.025f, true).setName("yield", "lowest");
public static final Allele yieldLower = new AlleleFloat("yieldLower", 0.05f, true).setName("yield", "lower");
public static final Allele yieldLow = new AlleleFloat("yieldLow", 0.1f, true).setName("yield", "low");
public static final Allele yieldAverage = new AlleleFloat("yieldDefault", 0.2f, true).setName("yield", "average");
public static final Allele yieldHigh = new AlleleFloat("yieldHigh", 0.3f, false).setName("yield", "high");
public static final Allele yieldHigher = new AlleleFloat("yieldHigher", 0.35f, false).setName("yield", "higher");
public static final Allele yieldHighest = new AlleleFloat("yieldHighest", 0.4f, false).setName("yield", "highest");
// TREES // SAPPINESS
public static final Allele sappinessLowest = new AlleleFloat("sappinessLowest", 0.1f, true).setName("sappiness", "lowest");
public static final Allele sappinessLower = new AlleleFloat("sappinessLower", 0.2f, true).setName("sappiness", "lower");
public static final Allele sappinessLow = new AlleleFloat("sappinessLow", 0.3f, true).setName("sappiness", "low");
public static final Allele sappinessAverage = new AlleleFloat("sappinessAverage", 0.4f, true).setName("sappiness", "average");
public static final Allele sappinessHigh = new AlleleFloat("sappinessHigh", 0.6f, true).setName("sappiness", "high");
public static final Allele sappinessHigher = new AlleleFloat("sappinessHigher", 0.8f, false).setName("sappiness", "higher");
public static final Allele sappinessHighest = new AlleleFloat("sappinessHighest", 1.0f, false).setName("sappiness", "highest");
// TREES // MATURATION TIME
public static final Allele maturationSlowest = new AlleleInteger("maturationSlowest", 10, true).setName("maturity", "slowest");
public static final Allele maturationSlower = new AlleleInteger("maturationSlower", 7).setName("maturity", "slower");
public static final Allele maturationSlow = new AlleleInteger("maturationSlow", 5, true).setName("maturity", "slow");
public static final Allele maturationAverage = new AlleleInteger("maturationAverage", 4).setName("maturity", "average");
public static final Allele maturationFast = new AlleleInteger("maturationFast", 3).setName("maturity", "fast");
public static final Allele maturationFaster = new AlleleInteger("maturationFaster", 2).setName("maturity", "faster");
public static final Allele maturationFastest = new AlleleInteger("maturationFastest", 1).setName("maturity", "fastest");
// / BEES // FLOWER GROWTH 1700 - 1749
public static final Allele floweringSlowest = new AlleleInteger("floweringSlowest", 5, true).setName("flowering", "slowest");
public static final Allele floweringSlower = new AlleleInteger("floweringSlower", 10).setName("flowering", "slower");
public static final Allele floweringSlow = new AlleleInteger("floweringSlow", 15).setName("flowering", "slow");
public static final Allele floweringAverage = new AlleleInteger("floweringAverage", 20).setName("flowering", "average");
public static final Allele floweringFast = new AlleleInteger("floweringFast", 25).setName("flowering", "fast");
public static final Allele floweringFaster = new AlleleInteger("floweringFaster", 30).setName("flowering", "faster");
public static final Allele floweringFastest = new AlleleInteger("floweringFastest", 35).setName("flowering", "fastest");
public static final Allele floweringMaximum = new AlleleInteger("floweringMaximum", 99, true).setName("flowering", "maximum");
// / BOTH // TERRITORY 1750 - 1799
public static final Allele territoryDefault = new AlleleArea("territoryDefault", new int[]{9, 6, 9}).setName("territory", "average");
public static final Allele territoryLarge = new AlleleArea("territoryLarge", new int[]{11, 8, 11}).setName("territory", "large");
public static final Allele territoryLarger = new AlleleArea("territoryLarger", new int[]{13, 12, 13}).setName("territory", "larger");
public static final Allele territoryLargest = new AlleleArea("territoryLargest", new int[]{15, 13, 15}).setName("territory", "largest");
// / BEES // EFFECTS 1800 - 1899
public static Allele effectNone;
public static Allele effectAggressive;
@@ -330,20 +185,16 @@ public class Allele implements IAllele {
public static Allele butterflyNone;
// These are "secondary" plant attributes, i.e. the tree can double as one.
public static final Allele plantTypeNone = new AllelePlantType("plantTypeNone", EnumSet.noneOf(EnumPlantType.class), true);
public static final Allele plantTypePlains = new AllelePlantType("plantTypePlains", EnumPlantType.Plains);
public static final Allele plantTypeDesert = new AllelePlantType("plantTypeDesert", EnumPlantType.Desert);
public static final Allele plantTypeBeach = new AllelePlantType("plantTypeBeach", EnumPlantType.Beach);
public static final Allele plantTypeCave = new AllelePlantType("plantTypeCave", EnumPlantType.Cave);
public static final Allele plantTypeWater = new AllelePlantType("plantTypeWater", EnumPlantType.Water);
public static final Allele plantTypeNether = new AllelePlantType("plantTypeNether", EnumPlantType.Nether);
public static final Allele plantTypeCrop = new AllelePlantType("plantTypeCrop", EnumPlantType.Crop);
public static final Allele plantTypeNone = new AllelePlantType("none", EnumSet.noneOf(EnumPlantType.class), true);
public static final Allele plantTypePlains = new AllelePlantType(EnumPlantType.Plains);
public static final Allele plantTypeDesert = new AllelePlantType(EnumPlantType.Desert);
public static final Allele plantTypeBeach = new AllelePlantType(EnumPlantType.Beach);
public static final Allele plantTypeCave = new AllelePlantType(EnumPlantType.Cave);
public static final Allele plantTypeWater = new AllelePlantType(EnumPlantType.Water);
public static final Allele plantTypeNether = new AllelePlantType(EnumPlantType.Nether);
public static final Allele plantTypeCrop = new AllelePlantType(EnumPlantType.Crop);
// / TREES // FIREPROOF
public static final Allele fireproofFalse = new AlleleBoolean("fireproofFalse", false);
public static final Allele fireproofTrue = new AlleleBoolean("fireproofTrue", true);
public static void setupLegacyAPI() {
public static void setupAPI() {
// LEGACY MAPPINGS
ILegacyHandler legacy = (ILegacyHandler) AlleleManager.alleleRegistry;
@@ -384,10 +235,6 @@ public class Allele implements IAllele {
legacy.registerLegacyMapping(29, "forestry.speciesVengeful");
legacy.registerLegacyMapping(30, "forestry.speciesAvenging");
legacy.registerLegacyMapping(Defaults.ID_BEE_SPECIES_DARKENED, "forestry.speciesDarkened");
legacy.registerLegacyMapping(Defaults.ID_BEE_SPECIES_REDDENED, "forestry.speciesReddened");
legacy.registerLegacyMapping(Defaults.ID_BEE_SPECIES_OMEGA, "forestry.speciesOmega");
legacy.registerLegacyMapping(34, "forestry.speciesLeporine");
legacy.registerLegacyMapping(40, "forestry.speciesRural");
@@ -488,11 +335,6 @@ public class Allele implements IAllele {
public String getUnlocalizedName() {
return name;
}
public Allele setName(String string) {
name = string;
return this;
}
@Override
public String toString() {
@@ -8,22 +8,17 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
package forestry.core.genetics.alleles;
import forestry.api.genetics.IAlleleArea;
import forestry.core.utils.StringUtil;
import forestry.core.vect.Vect;
public class AlleleArea extends Allele implements IAlleleArea {
public class AlleleArea extends AlleleForestry implements IAlleleArea {
private final int[] area;
public AlleleArea(String uid, int[] value) {
this(uid, value, false);
}
public AlleleArea(String uid, int[] value, boolean isDominant) {
super(uid, isDominant);
public AlleleArea(String prefix, String name, int[] value, boolean isDominant) {
super(prefix, name, isDominant, false);
this.area = value;
}
@@ -34,15 +29,4 @@ public class AlleleArea extends Allele implements IAlleleArea {
public Vect getArea() {
return new Vect(area);
}
public AlleleArea setName(String customPrefix, String name) {
String customName = "gui." + customPrefix + "." + name;
if (StringUtil.canTranslate(customName)) {
this.name = customName;
} else {
this.name = "gui." + name;
}
return this;
}
}
@@ -8,20 +8,16 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
package forestry.core.genetics.alleles;
import forestry.api.genetics.IAlleleBoolean;
public class AlleleBoolean extends Allele implements IAlleleBoolean {
public class AlleleBoolean extends AlleleForestry implements IAlleleBoolean {
final boolean value;
private final boolean value;
public AlleleBoolean(String uid, boolean value) {
this(uid, value, false);
}
public AlleleBoolean(String uid, boolean value, boolean isDominant) {
super(uid, isDominant);
public AlleleBoolean(String category, boolean value, boolean isDominant) {
super(category, Boolean.toString(value), isDominant);
this.value = value;
}
@@ -8,21 +8,20 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
package forestry.core.genetics.alleles;
import forestry.api.genetics.IAlleleFloat;
import forestry.core.utils.StringUtil;
public class AlleleFloat extends Allele implements IAlleleFloat {
public class AlleleFloat extends AlleleForestry implements IAlleleFloat {
private final float value;
public AlleleFloat(String uid, float value) {
this(uid, value, false);
public AlleleFloat(String prefix, String name, float value) {
this(prefix, name, value, false);
}
public AlleleFloat(String uid, float value, boolean isDominant) {
super(uid, isDominant);
public AlleleFloat(String prefix, String name, float value, boolean isDominant) {
super(prefix, name, isDominant);
this.value = value;
}
@@ -30,14 +29,4 @@ public class AlleleFloat extends Allele implements IAlleleFloat {
public float getValue() {
return value;
}
public AlleleFloat setName(String customPrefix, String name) {
String customName = "gui." + customPrefix + "." + name;
if (StringUtil.canTranslate(customName)) {
this.name = customName;
} else {
this.name = "gui." + name;
}
return this;
}
}
@@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics.alleles;
import org.apache.commons.lang3.text.WordUtils;
import forestry.core.utils.StringUtil;
public class AlleleForestry extends Allele {
public AlleleForestry(String prefix, String name, boolean isDominant) {
this(prefix, name, isDominant, false);
}
protected AlleleForestry(String prefix, String name, boolean isDominant, boolean skipRegister) {
super("forestry." + prefix + WordUtils.capitalize(name), isDominant, skipRegister);
setName(prefix, name);
}
private AlleleForestry setName(String customPrefix, String name) {
String customName = "gui." + customPrefix + '.' + name;
if (StringUtil.canTranslate(customName)) {
this.name = customName;
} else {
this.name = "gui." + name;
}
return this;
}
}
@@ -0,0 +1,155 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics.alleles;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.EnumTolerance;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleBoolean;
import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.IChromosomeType;
import forestry.apiculture.flowers.FlowerProvider;
import forestry.apiculture.genetics.AlleleFlowers;
import forestry.core.vect.IVect;
import forestry.plugins.PluginManager;
public class AlleleHelper implements IAlleleHelper {
private final Map<Class, Map<?, ? extends IAllele>> alleleMaps = new HashMap<Class, Map<?, ? extends IAllele>>();
public void init() {
if (PluginManager.Module.APICULTURE.isEnabled()) {
createAlleles(EnumAllele.Fertility.class);
createAlleles(EnumAllele.Flowering.class);
}
if (PluginManager.Module.APICULTURE.isEnabled() || PluginManager.Module.ARBORICULTURE.isEnabled()) {
createAlleles(EnumAllele.Territory.class);
AlleleManager.alleleRegistry.registerDeprecatedAlleleReplacement("forestry.territoryDefault", get(EnumAllele.Territory.AVERAGE));
}
if (PluginManager.Module.APICULTURE.isEnabled() || PluginManager.Module.LEPIDOPTEROLOGY.isEnabled()) {
createAlleles(EnumAllele.Speed.class);
createAlleles(EnumAllele.Lifespan.class);
createAlleles(EnumAllele.Tolerance.class);
createAlleles(EnumAllele.Flowers.class);
AlleleManager.alleleRegistry.registerDeprecatedAlleleReplacement("forestry.speedNorm", get(EnumAllele.Speed.NORMAL));
}
if (PluginManager.Module.ARBORICULTURE.isEnabled()) {
createAlleles(EnumAllele.Height.class);
createAlleles(EnumAllele.Saplings.class);
createAlleles(EnumAllele.Yield.class);
createAlleles(EnumAllele.Fireproof.class);
createAlleles(EnumAllele.Maturation.class);
createAlleles(EnumAllele.Sappiness.class);
AlleleManager.alleleRegistry.registerDeprecatedAlleleReplacement("forestry.heightMax10", get(EnumAllele.Height.AVERAGE));
AlleleManager.alleleRegistry.registerDeprecatedAlleleReplacement("forestry.saplingsDefault", get(EnumAllele.Saplings.AVERAGE));
AlleleManager.alleleRegistry.registerDeprecatedAlleleReplacement("forestry.saplingsDouble", get(EnumAllele.Saplings.HIGH));
AlleleManager.alleleRegistry.registerDeprecatedAlleleReplacement("forestry.saplingsTriple", get(EnumAllele.Saplings.HIGHER));
AlleleManager.alleleRegistry.registerDeprecatedAlleleReplacement("forestry.yieldDefault", get(EnumAllele.Yield.AVERAGE));
}
if (PluginManager.Module.LEPIDOPTEROLOGY.isEnabled()) {
createAlleles(EnumAllele.Size.class);
}
Map<Integer, IAlleleInteger> integers = new HashMap<Integer, IAlleleInteger>();
for (int i = 1; i <= 10; i++) {
IAlleleInteger alleleInteger = new AlleleInteger("i", i + "d", i, true);
integers.put(i, alleleInteger);
}
alleleMaps.put(Integer.class, integers);
Map<Boolean, IAlleleBoolean> booleans = new HashMap<Boolean, IAlleleBoolean>();
booleans.put(true, new AlleleBoolean("bool", true, false));
booleans.put(false, new AlleleBoolean("bool", false, false));
alleleMaps.put(Boolean.class, booleans);
}
private <T extends Enum<T> & IChromosomeType> IAllele get(Object value) {
Class<?> valueClass = value.getClass();
Map<?, ? extends IAllele> map = alleleMaps.get(valueClass);
if (map == null) {
throw new IllegalArgumentException("There is no IAllele type for: " + valueClass + ' ' + value);
}
IAllele allele = map.get(value);
if (allele == null) {
throw new IllegalArgumentException("There is no IAllele for: " + valueClass + ' ' + value);
}
return allele;
}
@Override
public <T extends Enum<T> & IChromosomeType> void set(IAllele[] alleles, T chromosomeType, IAllele allele) {
if (allele == null || !chromosomeType.getAlleleClass().isInstance(allele)) {
throw new IllegalArgumentException("Allele is the wrong type. Expected: " + chromosomeType + " Got: " + allele);
}
alleles[chromosomeType.ordinal()] = allele;
}
@Override
public <T extends Enum<T> & IChromosomeType> void set(IAllele[] alleles, T chromosomeType, IAlleleValue value) {
set(alleles, chromosomeType, get(value));
}
@Override
public <T extends Enum<T> & IChromosomeType> void set(IAllele[] alleles, T chromosomeType, boolean value) {
set(alleles, chromosomeType, get(value));
}
@Override
public <T extends Enum<T> & IChromosomeType> void set(IAllele[] alleles, T chromosomeType, int value) {
set(alleles, chromosomeType, get(value));
}
private <K extends Enum<K> & IAlleleValue<V>, V> void createAlleles(Class<K> enumClass) {
String category = enumClass.getSimpleName().toLowerCase(Locale.ENGLISH);
EnumMap<K, IAllele> map = new EnumMap<K, IAllele>(enumClass);
for (K enumValue : enumClass.getEnumConstants()) {
IAllele allele = createAllele(category, enumValue);
map.put(enumValue, allele);
}
alleleMaps.put(enumClass, map);
}
private static <K extends IAlleleValue<V>, V> IAllele createAllele(String category, K enumValue) {
V value = enumValue.getValue();
boolean isDominant = enumValue.isDominant();
String name = enumValue.toString().toLowerCase(Locale.ENGLISH);
Class<?> valueClass = value.getClass();
if (Float.class.isAssignableFrom(valueClass)) {
return new AlleleFloat(category, name, (Float) value, isDominant);
} else if (Integer.class.isAssignableFrom(valueClass)) {
return new AlleleInteger(category, name, (Integer) value, isDominant);
} else if (IVect.class.isAssignableFrom(valueClass)) {
int[] area = ((IVect) value).toArray();
return new AlleleArea(category, name, area, isDominant);
} else if (Boolean.class.isAssignableFrom(valueClass)) {
return new AlleleBoolean(category, (Boolean) value, isDominant);
} else if (EnumTolerance.class.isAssignableFrom(valueClass)) {
return new AlleleTolerance(category, name, (EnumTolerance) value, isDominant);
} else if (FlowerProvider.class.isAssignableFrom(valueClass)) {
return new AlleleFlowers(category, name, (FlowerProvider) value, isDominant);
}
throw new RuntimeException("could not create allele for category: " + category + " and value " + valueClass);
}
}
@@ -8,21 +8,20 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
package forestry.core.genetics.alleles;
import forestry.api.genetics.IAlleleInteger;
import forestry.core.utils.StringUtil;
public class AlleleInteger extends Allele implements IAlleleInteger {
public class AlleleInteger extends AlleleForestry implements IAlleleInteger {
private final int value;
public AlleleInteger(String uid, int value) {
this(uid, value, false);
public AlleleInteger(String prefix, String name, int value) {
this(prefix, name, value, false);
}
public AlleleInteger(String uid, int value, boolean isDominant) {
super(uid, isDominant);
public AlleleInteger(String prefix, String name, int value, boolean isDominant) {
super(prefix, name, isDominant);
this.value = value;
}
@@ -30,15 +29,4 @@ public class AlleleInteger extends Allele implements IAlleleInteger {
public int getValue() {
return value;
}
public AlleleInteger setName(String customPrefix, String name) {
String customName = "gui." + customPrefix + "." + name;
if (StringUtil.canTranslate(customName)) {
this.name = customName;
} else {
this.name = "gui." + name;
}
return this;
}
}
@@ -8,28 +8,29 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
package forestry.core.genetics.alleles;
import java.util.EnumSet;
import java.util.Locale;
import net.minecraftforge.common.EnumPlantType;
import forestry.api.genetics.IAllelePlantType;
public class AllelePlantType extends Allele implements IAllelePlantType {
public class AllelePlantType extends AlleleForestry implements IAllelePlantType {
private final EnumSet<EnumPlantType> types;
protected AllelePlantType(String uid, EnumPlantType type) {
this(uid, type, false);
protected AllelePlantType(EnumPlantType type) {
this(type, false);
}
protected AllelePlantType(String uid, EnumPlantType type, boolean isDominant) {
this(uid, EnumSet.of(type), isDominant);
protected AllelePlantType(EnumPlantType type, boolean isDominant) {
this(type.toString().toLowerCase(Locale.ENGLISH), EnumSet.of(type), isDominant);
}
protected AllelePlantType(String uid, EnumSet<EnumPlantType> types, boolean isDominant) {
super(uid, isDominant);
protected AllelePlantType(String name, EnumSet<EnumPlantType> types, boolean isDominant) {
super("plantType", name, isDominant);
this.types = types;
}
@@ -8,7 +8,7 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
package forestry.core.genetics.alleles;
import java.util.ArrayList;
import java.util.Collection;
@@ -34,6 +34,7 @@ import forestry.api.genetics.ILegacyHandler;
import forestry.api.genetics.IMutation;
import forestry.api.genetics.ISpeciesRoot;
import forestry.core.config.ForestryItem;
import forestry.core.genetics.Classification;
import forestry.core.genetics.ItemResearchNote.EnumNoteType;
public class AlleleRegistry implements IAlleleRegistry, ILegacyHandler {
@@ -8,12 +8,13 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
package forestry.core.genetics.alleles;
import java.util.Collection;
import java.util.Map;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
@@ -25,19 +26,18 @@ import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.core.IIconProvider;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IAlleleSpeciesCustom;
import forestry.api.genetics.IClassification;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IMutation;
import forestry.core.config.ForestryItem;
import forestry.core.utils.StackUtils;
import forestry.core.utils.StringUtil;
public abstract class AlleleSpecies extends Allele implements IAlleleSpecies {
public abstract class AlleleSpecies extends Allele implements IAlleleSpeciesCustom {
private final String binomial;
private final String authority;
private String description = null;
private int complexity = 3;
private boolean hasEffect = false;
private boolean isSecret = false;
private boolean isCounted = true;
@@ -45,13 +45,14 @@ public abstract class AlleleSpecies extends Allele implements IAlleleSpecies {
private EnumTemperature climate = EnumTemperature.NORMAL;
private EnumHumidity humidity = EnumHumidity.NORMAL;
public AlleleSpecies(String uid, boolean isDominant, String name, IClassification branch, String binomial, boolean doRegister) {
public AlleleSpecies(String uid, String authority, String unlocalizedDescription, boolean isDominant, String name, IClassification branch, String binomial, boolean doRegister) {
super(uid, isDominant, true);
this.branch = branch;
this.name = name;
this.binomial = binomial;
this.description = StringUtil.localize("description." + uid);
this.description = StatCollector.translateToLocal(unlocalizedDescription);
this.authority = authority;
// FIXME: do not register here
if (doRegister) {
@@ -64,11 +65,6 @@ public abstract class AlleleSpecies extends Allele implements IAlleleSpecies {
return description;
}
@Override
public int getComplexity() {
return complexity;
}
@Override
public float getResearchSuitability(ItemStack itemstack) {
if (itemstack == null) {
@@ -146,7 +142,7 @@ public abstract class AlleleSpecies extends Allele implements IAlleleSpecies {
@Override
public String getAuthority() {
return "Sengir";
return authority;
}
@Override
@@ -154,42 +150,50 @@ public abstract class AlleleSpecies extends Allele implements IAlleleSpecies {
return this.branch;
}
@SuppressWarnings("unchecked")
public <T extends AlleleSpecies> T setComplexity(int complexity) {
this.complexity = complexity;
return (T) this;
@Override
public IAlleleSpeciesCustom setTemperature(EnumTemperature temperature) {
climate = temperature;
return this;
}
@Override
public IAlleleSpeciesCustom setHumidity(EnumHumidity humidity) {
this.humidity = humidity;
return this;
}
@Override
public IAlleleSpeciesCustom setHasEffect() {
hasEffect = true;
return this;
}
@Override
public IAlleleSpeciesCustom setIsSecret() {
isSecret = true;
return this;
}
@Override
public IAlleleSpeciesCustom setIsNotCounted() {
isCounted = false;
return this;
}
@Deprecated
@SuppressWarnings("unchecked")
public <T extends AlleleSpecies> T setTemperature(EnumTemperature temperature) {
public <T extends AlleleSpecies> T setTemperatureDeprecated(EnumTemperature temperature) {
climate = temperature;
return (T) this;
}
@Deprecated
@SuppressWarnings("unchecked")
public <T extends AlleleSpecies> T setHumidity(EnumHumidity humidity) {
public <T extends AlleleSpecies> T setHumidityDeprecated(EnumHumidity humidity) {
this.humidity = humidity;
return (T) this;
}
@SuppressWarnings("unchecked")
public <T extends AlleleSpecies> T setHasEffect() {
hasEffect = true;
return (T) this;
}
@SuppressWarnings("unchecked")
public <T extends AlleleSpecies> T setIsSecret() {
isSecret = true;
return (T) this;
}
@SuppressWarnings("unchecked")
public <T extends AlleleSpecies> T setIsNotCounted() {
isCounted = false;
return (T) this;
}
@Override
@SideOnly(Side.CLIENT)
public abstract IIconProvider getIconProvider();
@@ -8,21 +8,17 @@
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics;
package forestry.core.genetics.alleles;
import forestry.api.genetics.EnumTolerance;
import forestry.api.genetics.IAlleleTolerance;
public class AlleleTolerance extends Allele implements IAlleleTolerance {
public class AlleleTolerance extends AlleleForestry implements IAlleleTolerance {
private final EnumTolerance value;
public AlleleTolerance(String uid, EnumTolerance value) {
this(uid, value, false);
}
public AlleleTolerance(String uid, EnumTolerance value, boolean isDominant) {
super(uid, isDominant);
public AlleleTolerance(String category, String name, EnumTolerance value, boolean isDominant) {
super(category, name, isDominant);
this.value = value;
}
@@ -0,0 +1,456 @@
package forestry.core.genetics.alleles;
import java.util.Locale;
import forestry.api.apiculture.FlowerManager;
import forestry.api.genetics.EnumTolerance;
import forestry.apiculture.flowers.FlowerProvider;
import forestry.core.vect.IVect;
import forestry.core.vect.Vect;
public class EnumAllele {
public enum Fertility implements IAlleleValue<Integer> {
LOW(1, true),
NORMAL(2, true),
HIGH(3),
MAXIMUM(4);
private final Integer value;
private final boolean dominant;
Fertility(Integer value) {
this(value, false);
}
Fertility(Integer value, boolean dominant) {
this.value = value;
this.dominant = dominant;
}
@Override
public Integer getValue() {
return value;
}
@Override
public boolean isDominant() {
return dominant;
}
}
public enum Fireproof implements IAlleleValue<Boolean> {
TRUE(true),
FALSE(false);
private final boolean value;
private final boolean dominant;
Fireproof(boolean value) {
this(value, false);
}
Fireproof(boolean value, boolean dominant) {
this.value = value;
this.dominant = dominant;
}
@Override
public boolean isDominant() {
return dominant;
}
@Override
public Boolean getValue() {
return value;
}
}
public enum Flowering implements IAlleleValue<Integer> {
SLOWEST(5, true),
SLOWER(10),
SLOW(15),
AVERAGE(20),
FAST(25),
FASTER(30),
FASTEST(35);
private final Integer value;
private final boolean dominant;
Flowering(Integer value) {
this(value, false);
}
Flowering(Integer value, boolean dominant) {
this.value = value;
this.dominant = dominant;
}
@Override
public Integer getValue() {
return value;
}
@Override
public boolean isDominant() {
return dominant;
}
}
public enum Flowers implements IAlleleValue<FlowerProvider> {
VANILLA(FlowerManager.FlowerTypeVanilla, true),
NETHER(FlowerManager.FlowerTypeNether),
CACTI(FlowerManager.FlowerTypeCacti),
MUSHROOMS(FlowerManager.FlowerTypeMushrooms),
END(FlowerManager.FlowerTypeEnd),
JUNGLE(FlowerManager.FlowerTypeJungle),
SNOW(FlowerManager.FlowerTypeSnow, true),
WHEAT(FlowerManager.FlowerTypeWheat, true),
GOURD(FlowerManager.FlowerTypeGourd, true);
private final FlowerProvider value;
private final boolean dominant;
Flowers(String flowerType) {
this(flowerType, false);
}
Flowers(String flowerType, boolean dominant) {
String lowercaseName = toString().toLowerCase(Locale.ENGLISH);
this.value = new FlowerProvider(flowerType, "flowers." + lowercaseName);
this.dominant = dominant;
}
@Override
public FlowerProvider getValue() {
return value;
}
@Override
public boolean isDominant() {
return dominant;
}
}
public enum Height implements IAlleleValue<Float> {
SMALLEST(0.25f),
SMALLER(0.5f),
SMALL(0.75f),
AVERAGE(1.0f),
LARGE(1.25f),
LARGER(1.5f),
LARGEST(1.75f),
GIGANTIC(2.0f);
private final float value;
private final boolean dominant;
Height(float value) {
this(value, false);
}
Height(float value, boolean dominant) {
this.value = value;
this.dominant = dominant;
}
@Override
public Float getValue() {
return value;
}
@Override
public boolean isDominant() {
return dominant;
}
}
public enum Lifespan implements IAlleleValue<Integer> {
SHORTEST(10),
SHORTER(20, true),
SHORT(30, true),
SHORTENED(35, true),
NORMAL(40),
ELONGATED(45, true),
LONG(50),
LONGER(60),
LONGEST(70);
private final Integer value;
private final boolean dominant;
Lifespan(Integer value) {
this(value, false);
}
Lifespan(Integer value, boolean dominant) {
this.value = value;
this.dominant = dominant;
}
@Override
public Integer getValue() {
return value;
}
@Override
public boolean isDominant() {
return dominant;
}
}
public enum Maturation implements IAlleleValue<Integer> {
SLOWEST(10, true),
SLOWER(7),
SLOW(5, true),
AVERAGE(4),
FAST(3),
FASTER(2),
FASTEST(1);
private final Integer value;
private final boolean dominant;
Maturation(Integer value) {
this(value, false);
}
Maturation(Integer value, boolean dominant) {
this.value = value;
this.dominant = dominant;
}
@Override
public Integer getValue() {
return value;
}
@Override
public boolean isDominant() {
return dominant;
}
}
public enum Saplings implements IAlleleValue<Float> {
LOWEST(0.01f, true),
LOWER(0.025f, true),
LOW(0.035f, true),
AVERAGE(0.05f, true),
HIGH(0.1f, true),
HIGHER(0.2f, true),
HIGHEST(0.3f, true);
private final float value;
private final boolean dominant;
Saplings(float value) {
this(value, false);
}
Saplings(float value, boolean dominant) {
this.value = value;
this.dominant = dominant;
}
@Override
public Float getValue() {
return value;
}
@Override
public boolean isDominant() {
return dominant;
}
}
public enum Sappiness implements IAlleleValue<Float> {
LOWEST(0.1f, true),
LOWER(0.2f, true),
LOW(0.3f, true),
AVERAGE(0.4f, true),
HIGH(0.6f, true),
HIGHER(0.8f),
HIGHEST(1.0f);
private final Float value;
private final boolean dominant;
Sappiness(Float value) {
this(value, false);
}
Sappiness(Float value, boolean dominant) {
this.value = value;
this.dominant = dominant;
}
@Override
public Float getValue() {
return value;
}
@Override
public boolean isDominant() {
return dominant;
}
}
public enum Size implements IAlleleValue<Float> {
SMALLEST(0.3f),
SMALLER(0.4f),
SMALL(0.5f),
AVERAGE(0.6f),
LARGE(0.75f),
LARGER(0.9f),
LARGEST(1.0f);
private final float value;
private final boolean dominant;
Size(float value) {
this(value, false);
}
Size(float value, boolean dominant) {
this.value = value;
this.dominant = dominant;
}
@Override
public Float getValue() {
return value;
}
@Override
public boolean isDominant() {
return dominant;
}
}
public enum Speed implements IAlleleValue<Float> {
SLOWEST(0.3f, true),
SLOWER(0.6f, true),
SLOW(0.8f, true),
NORMAL(1.0f),
FAST(1.2f, true),
FASTER(1.4f),
FASTEST(1.7f);
private final float value;
private final boolean dominant;
Speed(float value) {
this(value, false);
}
Speed(float value, boolean dominant) {
this.value = value;
this.dominant = dominant;
}
@Override
public Float getValue() {
return value;
}
@Override
public boolean isDominant() {
return dominant;
}
}
public enum Territory implements IAlleleValue<IVect> {
AVERAGE(9, 6, 9),
LARGE(11, 8, 11),
LARGER(13, 12, 13),
LARGEST(15, 13, 15);
private final IVect area;
private final boolean dominant;
Territory(int x, int y, int z) {
this(x, y, z, false);
}
Territory(int x, int y, int z, boolean dominant) {
this.area = new Vect(x, y, z);
this.dominant = dominant;
}
@Override
public IVect getValue() {
return area;
}
@Override
public boolean isDominant() {
return dominant;
}
}
public enum Tolerance implements IAlleleValue<EnumTolerance> {
NONE,
BOTH_1(true), BOTH_2, BOTH_3, BOTH_4, BOTH_5,
UP_1(true), UP_2, UP_3, UP_4, UP_5,
DOWN_1(true), DOWN_2, DOWN_3, DOWN_4, DOWN_5;
private final EnumTolerance value;
private final boolean dominant;
Tolerance() {
this(false);
}
Tolerance(boolean dominant) {
this.value = EnumTolerance.values()[ordinal()];
this.dominant = dominant;
}
@Override
public String toString() {
return super.toString().replace("_", "");
}
@Override
public EnumTolerance getValue() {
return value;
}
@Override
public boolean isDominant() {
return dominant;
}
}
public enum Yield implements IAlleleValue<Float> {
LOWEST(0.025f, true),
LOWER(0.05f, true),
LOW(0.1f, true),
AVERAGE(0.2f, true),
HIGH(0.3f),
HIGHER(0.35f),
HIGHEST(0.4f);
private final float value;
private final boolean dominant;
Yield(float value) {
this(value, false);
}
Yield(float value, boolean dominant) {
this.value = value;
this.dominant = dominant;
}
@Override
public Float getValue() {
return value;
}
@Override
public boolean isDominant() {
return dominant;
}
}
}
@@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.genetics.alleles;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType;
public interface IAlleleHelper {
<T extends Enum<T> & IChromosomeType> void set(IAllele[] alleles, T chromosomeType, IAllele allele);
<T extends Enum<T> & IChromosomeType> void set(IAllele[] alleles, T chromosomeType, IAlleleValue value);
<T extends Enum<T> & IChromosomeType> void set(IAllele[] alleles, T chromosomeType, boolean value);
<T extends Enum<T> & IChromosomeType> void set(IAllele[] alleles, T chromosomeType, int value);
}
@@ -0,0 +1,7 @@
package forestry.core.genetics.alleles;
public interface IAlleleValue<V> {
boolean isDominant();
V getValue();
}
@@ -0,0 +1,102 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.utils;
import java.text.DateFormatSymbols;
import java.util.Calendar;
/**
* Fed up with Date and Calendar and their shenanigans
*/
public 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() {
String monthName = new DateFormatSymbols().getMonths()[month - 1];
return monthName + ' ' + day;
}
}
@@ -27,4 +27,6 @@ public interface IVect {
IVect add(int x, int y, int z);
IVect add(ForgeDirection direction);
int[] toArray();
}
@@ -54,6 +54,11 @@ public class MutableVect implements IVect {
return this;
}
@Override
public int[] toArray() {
return new int[]{x, y, z};
}
public boolean advancePositionInArea(Vect area) {
// Increment z first until end reached
if (z < area.z - 1) {
@@ -76,6 +76,11 @@ public class Vect implements IVect {
return add(direction.offsetX, direction.offsetY, direction.offsetZ);
}
@Override
public int[] toArray() {
return new int[]{x, y, z};
}
public Vect multiply(float factor) {
return new Vect(Math.round(x * factor), Math.round(y * factor), Math.round(z * factor));
}
@@ -34,7 +34,7 @@ import forestry.api.lepidopterology.EnumFlutterType;
import forestry.api.lepidopterology.IAlleleButterflySpecies;
import forestry.api.lepidopterology.IButterflyRoot;
import forestry.core.config.Defaults;
import forestry.core.genetics.AlleleSpecies;
import forestry.core.genetics.alleles.AlleleSpecies;
public class AlleleButterflySpecies extends AlleleSpecies implements IAlleleButterflySpecies {
@@ -52,7 +52,7 @@ public class AlleleButterflySpecies extends AlleleSpecies implements IAlleleButt
private final Map<ItemStack, Float> caterpillarLoot = new HashMap<ItemStack, Float>();
public AlleleButterflySpecies(String uid, boolean isDominant, String name, IClassification branch, String binomial, int serumColour) {
super(uid, isDominant, "butterflies.species." + branch.getParent().getUID().substring((branch.getParent().getLevel().name().toLowerCase(Locale.ENGLISH)).length() + 1) + "." + name, branch, binomial, true);
super("forestry." + uid, "Sengir", "for.description." + uid, isDominant, "butterflies.species." + branch.getParent().getUID().substring((branch.getParent().getLevel().name().toLowerCase(Locale.ENGLISH)).length() + 1) + "." + name, branch, binomial, true);
this.root = (IButterflyRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootButterflies");
this.serumColour = serumColour;
texture = "forestry:" + Defaults.TEXTURE_PATH_ENTITIES + "/butterflies/" + uid + ".png";
@@ -13,12 +13,12 @@ package forestry.lepidopterology.genetics;
import forestry.api.genetics.IEffectData;
import forestry.api.lepidopterology.IAlleleButterflyEffect;
import forestry.api.lepidopterology.IEntityButterfly;
import forestry.core.genetics.Allele;
import forestry.core.genetics.alleles.AlleleForestry;
public class AlleleEffectNone extends Allele implements IAlleleButterflyEffect {
public class AlleleEffectNone extends AlleleForestry implements IAlleleButterflyEffect {
public AlleleEffectNone(String uid, boolean isDominant) {
super(uid, isDominant, false);
public AlleleEffectNone(String prefix, String name, boolean isDominant) {
super(prefix, name, isDominant);
}
@Override
@@ -24,9 +24,9 @@ import forestry.api.lepidopterology.EnumButterflyChromosome;
import forestry.api.lepidopterology.IAlleleButterflyEffect;
import forestry.api.lepidopterology.IAlleleButterflySpecies;
import forestry.api.lepidopterology.IButterflyGenome;
import forestry.core.genetics.AlleleBoolean;
import forestry.core.genetics.AlleleTolerance;
import forestry.core.genetics.Genome;
import forestry.core.genetics.alleles.AlleleBoolean;
import forestry.core.genetics.alleles.AlleleTolerance;
import forestry.plugins.PluginLepidopterology;
public class ButterflyGenome extends Genome implements IButterflyGenome {
@@ -12,294 +12,302 @@ package forestry.lepidopterology.genetics;
import forestry.api.genetics.IAllele;
import forestry.api.lepidopterology.EnumButterflyChromosome;
import forestry.core.genetics.Allele;
import forestry.core.genetics.alleles.Allele;
import forestry.core.genetics.alleles.EnumAllele;
public class ButterflyTemplates {
public static IAllele[] getDefaultTemplate() {
IAllele[] alleles = new IAllele[EnumButterflyChromosome.values().length];
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiCabbageWhite;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeSmall;
alleles[EnumButterflyChromosome.SPEED.ordinal()] = Allele.speedSlowest;
alleles[EnumButterflyChromosome.LIFESPAN.ordinal()] = Allele.lifespanShorter;
alleles[EnumButterflyChromosome.METABOLISM.ordinal()] = Allele.int3;
alleles[EnumButterflyChromosome.FERTILITY.ordinal()] = Allele.int3;
alleles[EnumButterflyChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceNone;
alleles[EnumButterflyChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceNone;
alleles[EnumButterflyChromosome.NOCTURNAL.ordinal()] = Allele.boolFalse;
alleles[EnumButterflyChromosome.TOLERANT_FLYER.ordinal()] = Allele.boolFalse;
alleles[EnumButterflyChromosome.FIRE_RESIST.ordinal()] = Allele.boolFalse;
alleles[EnumButterflyChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowersVanilla;
alleles[EnumButterflyChromosome.EFFECT.ordinal()] = Allele.butterflyNone;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiCabbageWhite);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.SMALL);
Allele.helper.set(alleles, EnumButterflyChromosome.SPEED, EnumAllele.Speed.SLOWEST);
Allele.helper.set(alleles, EnumButterflyChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
Allele.helper.set(alleles, EnumButterflyChromosome.METABOLISM, 3);
Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 3);
Allele.helper.set(alleles, EnumButterflyChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE);
Allele.helper.set(alleles, EnumButterflyChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE);
Allele.helper.set(alleles, EnumButterflyChromosome.NOCTURNAL, false);
Allele.helper.set(alleles, EnumButterflyChromosome.TOLERANT_FLYER, false);
Allele.helper.set(alleles, EnumButterflyChromosome.FIRE_RESIST, false);
Allele.helper.set(alleles, EnumButterflyChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.VANILLA);
Allele.helper.set(alleles, EnumButterflyChromosome.EFFECT, Allele.butterflyNone);
return alleles;
}
public static IAllele[] getCabbageWhiteTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeAverage;
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.AVERAGE);
return alleles;
}
public static IAllele[] getGlasswingTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiGlasswing;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeSmaller;
alleles[EnumButterflyChromosome.LIFESPAN.ordinal()] = Allele.lifespanShort;
alleles[EnumButterflyChromosome.FERTILITY.ordinal()] = Allele.int5;
alleles[EnumButterflyChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceDown1;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiGlasswing);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.SMALLER);
Allele.helper.set(alleles, EnumButterflyChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 5);
Allele.helper.set(alleles, EnumButterflyChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
return alleles;
}
public static IAllele[] getEmeraldPeacockTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiEmeraldPeacock;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeLarge;
alleles[EnumButterflyChromosome.LIFESPAN.ordinal()] = Allele.lifespanNormal;
alleles[EnumButterflyChromosome.FERTILITY.ordinal()] = Allele.int5;
alleles[EnumButterflyChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceDown1;
alleles[EnumButterflyChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceDown1;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiEmeraldPeacock);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.LARGE);
Allele.helper.set(alleles, EnumButterflyChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 5);
Allele.helper.set(alleles, EnumButterflyChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
Allele.helper.set(alleles, EnumButterflyChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
return alleles;
}
public static IAllele[] getCitrusSwallowTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiCitrusSwallow;
alleles[EnumButterflyChromosome.SPEED.ordinal()] = Allele.speedSlower;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeLarge;
alleles[EnumButterflyChromosome.FERTILITY.ordinal()] = Allele.int10;
alleles[EnumButterflyChromosome.METABOLISM.ordinal()] = Allele.int8;
alleles[EnumButterflyChromosome.LIFESPAN.ordinal()] = Allele.lifespanShorter;
alleles[EnumButterflyChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceDown1;
alleles[EnumButterflyChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceDown1;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiCitrusSwallow);
Allele.helper.set(alleles, EnumButterflyChromosome.SPEED, EnumAllele.Speed.SLOWER);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.LARGE);
Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 10);
Allele.helper.set(alleles, EnumButterflyChromosome.METABOLISM, 8);
Allele.helper.set(alleles, EnumButterflyChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
Allele.helper.set(alleles, EnumButterflyChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
Allele.helper.set(alleles, EnumButterflyChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
return alleles;
}
public static IAllele[] getBlackSwallowTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiBlackSwallow;
alleles[EnumButterflyChromosome.SPEED.ordinal()] = Allele.speedSlow;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeLarge;
alleles[EnumButterflyChromosome.LIFESPAN.ordinal()] = Allele.lifespanShorter;
alleles[EnumButterflyChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceDown1;
alleles[EnumButterflyChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceDown1;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiBlackSwallow);
Allele.helper.set(alleles, EnumButterflyChromosome.SPEED, EnumAllele.Speed.SLOW);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.LARGE);
Allele.helper.set(alleles, EnumButterflyChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
Allele.helper.set(alleles, EnumButterflyChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
Allele.helper.set(alleles, EnumButterflyChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
return alleles;
}
public static IAllele[] getBrimstoneMothTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.mothBrimstone;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.mothBrimstone);
return alleles;
}
public static IAllele[] getSpeckledWoodTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiSpeckledWood;
alleles[EnumButterflyChromosome.FERTILITY.ordinal()] = Allele.int2;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiSpeckledWood);
Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 2);
;
return alleles;
}
public static IAllele[] getMadeiranSpeckledWoodTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiMadeiranSpeckledWood;
alleles[EnumButterflyChromosome.FERTILITY.ordinal()] = Allele.int2;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiMadeiranSpeckledWood);
Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 2);
;
return alleles;
}
public static IAllele[] getCanarySpeckledWoodTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiCanarySpeckledWood;
alleles[EnumButterflyChromosome.FERTILITY.ordinal()] = Allele.int2;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiCanarySpeckledWood);
Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 2);
;
return alleles;
}
public static IAllele[] getMenelausBlueMorphoTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiMenelausBlueMorpho;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeLarger;
alleles[EnumButterflyChromosome.LIFESPAN.ordinal()] = Allele.lifespanShortest;
alleles[EnumButterflyChromosome.FERTILITY.ordinal()] = Allele.int2;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiMenelausBlueMorpho);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.LARGER);
Allele.helper.set(alleles, EnumButterflyChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTEST);
Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 2);
;
return alleles;
}
public static IAllele[] getRhetenorBlueMorphoTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiRhetenorBlueMorpho;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeLarger;
alleles[EnumButterflyChromosome.LIFESPAN.ordinal()] = Allele.lifespanShortest;
alleles[EnumButterflyChromosome.FERTILITY.ordinal()] = Allele.int2;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiRhetenorBlueMorpho);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.LARGER);
Allele.helper.set(alleles, EnumButterflyChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTEST);
Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 2);
;
return alleles;
}
public static IAllele[] getPeleidesBlueMorphoTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiPeleidesBlueMorpho;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeLarger;
alleles[EnumButterflyChromosome.LIFESPAN.ordinal()] = Allele.lifespanShortest;
alleles[EnumButterflyChromosome.FERTILITY.ordinal()] = Allele.int2;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiPeleidesBlueMorpho);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.LARGER);
Allele.helper.set(alleles, EnumButterflyChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTEST);
Allele.helper.set(alleles, EnumButterflyChromosome.FERTILITY, 2);
;
return alleles;
}
public static IAllele[] getBrimstoneTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiBrimstone;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiBrimstone);
return alleles;
}
public static IAllele[] getAuroraTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiAurora;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeSmaller;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiAurora);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.SMALLER);
return alleles;
}
public static IAllele[] getPostillionTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiPostillion;
alleles[EnumButterflyChromosome.SPEED.ordinal()] = Allele.speedSlow;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiPostillion);
Allele.helper.set(alleles, EnumButterflyChromosome.SPEED, EnumAllele.Speed.SLOW);
return alleles;
}
public static IAllele[] getPalaenoSulphurTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiPalaenoSulphur;
alleles[EnumButterflyChromosome.SPEED.ordinal()] = Allele.speedSlower;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiPalaenoSulphur);
Allele.helper.set(alleles, EnumButterflyChromosome.SPEED, EnumAllele.Speed.SLOWER);
return alleles;
}
public static IAllele[] getResedaTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiReseda;
alleles[EnumButterflyChromosome.SPEED.ordinal()] = Allele.speedSlower;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiReseda);
Allele.helper.set(alleles, EnumButterflyChromosome.SPEED, EnumAllele.Speed.SLOWER);
return alleles;
}
public static IAllele[] getSpringAzureTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiSpringAzure;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeSmaller;
alleles[EnumButterflyChromosome.LIFESPAN.ordinal()] = Allele.lifespanShort;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiSpringAzure);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.SMALLER);
Allele.helper.set(alleles, EnumButterflyChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
return alleles;
}
public static IAllele[] getGozoraAzureTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiGozoraAzure;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeSmaller;
alleles[EnumButterflyChromosome.LIFESPAN.ordinal()] = Allele.lifespanShort;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiGozoraAzure);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.SMALLER);
Allele.helper.set(alleles, EnumButterflyChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
return alleles;
}
public static IAllele[] getCommaTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiComma;
alleles[EnumButterflyChromosome.SPEED.ordinal()] = Allele.speedSlower;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiComma);
Allele.helper.set(alleles, EnumButterflyChromosome.SPEED, EnumAllele.Speed.SLOWER);
return alleles;
}
public static IAllele[] getBatesiaTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiBatesia;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeLarge;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiBatesia);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.LARGE);
return alleles;
}
public static IAllele[] getBlueWingTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiBlueWing;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeAverage;
alleles[EnumButterflyChromosome.METABOLISM.ordinal()] = Allele.int5;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiBlueWing);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.AVERAGE);
Allele.helper.set(alleles, EnumButterflyChromosome.METABOLISM, 5);
;
return alleles;
}
public static IAllele[] getBlueDukeTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiBlueDuke;
alleles[EnumButterflyChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceBoth1;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiBlueDuke);
Allele.helper.set(alleles, EnumButterflyChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
return alleles;
}
public static IAllele[] getGlassyTigerTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiGlassyTiger;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeAverage;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiGlassyTiger);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.AVERAGE);
return alleles;
}
public static IAllele[] getPostmanTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiPostman;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiPostman);
return alleles;
}
public static IAllele[] getSpicebushTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiSpicebush;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeAverage;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiSpicebush);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.AVERAGE);
return alleles;
}
public static IAllele[] getMalachiteTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiMalachite;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeAverage;
alleles[EnumButterflyChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceDown1;
alleles[EnumButterflyChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceDown1;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiMalachite);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.AVERAGE);
Allele.helper.set(alleles, EnumButterflyChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
Allele.helper.set(alleles, EnumButterflyChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
return alleles;
}
public static IAllele[] getLeopardLacewingTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiLLacewing;
alleles[EnumButterflyChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.toleranceUp1;
alleles[EnumButterflyChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.toleranceUp1;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiLLacewing);
Allele.helper.set(alleles, EnumButterflyChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
Allele.helper.set(alleles, EnumButterflyChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.UP_1);
return alleles;
}
public static IAllele[] getMonarchTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiMonarch;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeAverage;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiMonarch);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.AVERAGE);
return alleles;
}
public static IAllele[] getThoasSwallowTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiThoasSwallow;
alleles[EnumButterflyChromosome.SPEED.ordinal()] = Allele.speedSlower;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeLarge;
alleles[EnumButterflyChromosome.LIFESPAN.ordinal()] = Allele.lifespanShortest;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiThoasSwallow);
Allele.helper.set(alleles, EnumButterflyChromosome.SPEED, EnumAllele.Speed.SLOWER);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.LARGE);
Allele.helper.set(alleles, EnumButterflyChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTEST);
return alleles;
}
public static IAllele[] getZebraSwallowTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiZebraSwallow;
alleles[EnumButterflyChromosome.SPEED.ordinal()] = Allele.speedSlower;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeAverage;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiZebraSwallow);
Allele.helper.set(alleles, EnumButterflyChromosome.SPEED, EnumAllele.Speed.SLOWER);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.AVERAGE);
return alleles;
}
public static IAllele[] getDianaFritTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.lepiDianaFrit;
alleles[EnumButterflyChromosome.SPEED.ordinal()] = Allele.speedSlower;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeSmaller;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.lepiDianaFrit);
Allele.helper.set(alleles, EnumButterflyChromosome.SPEED, EnumAllele.Speed.SLOWER);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.SMALLER);
return alleles;
}
public static IAllele[] getLatticedHeathTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.mothLatticedHeath;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeSmallest;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.mothLatticedHeath);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.SMALLEST);
return alleles;
}
public static IAllele[] getAtlasMothTemplate() {
IAllele[] alleles = getDefaultTemplate();
alleles[EnumButterflyChromosome.SPECIES.ordinal()] = Allele.mothAtlas;
alleles[EnumButterflyChromosome.SIZE.ordinal()] = Allele.sizeLargest;
Allele.helper.set(alleles, EnumButterflyChromosome.SPECIES, Allele.mothAtlas);
Allele.helper.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.LARGEST);
return alleles;
}
@@ -23,8 +23,8 @@ import forestry.api.lepidopterology.EnumButterflyChromosome;
import forestry.api.lepidopterology.IAlleleButterflySpecies;
import forestry.api.lepidopterology.IButterfly;
import forestry.core.config.ForestryItem;
import forestry.core.genetics.AlleleBoolean;
import forestry.core.genetics.GenericRatings;
import forestry.core.genetics.alleles.AlleleBoolean;
import forestry.core.gui.ContainerAlyzer;
import forestry.core.gui.GuiAlyzer;
import forestry.core.utils.StringUtil;
@@ -13,10 +13,10 @@ import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import forestry.api.apiculture.BeeManager;
import forestry.core.network.GuiId;
import forestry.pipes.gui.ContainerPropolisPipe;
import forestry.pipes.gui.GuiPropolisPipe;
import forestry.plugins.PluginApiculture;
import buildcraft.transport.Pipe;
import buildcraft.transport.TileGenericPipe;
@@ -63,7 +63,7 @@ public class GuiHandlerPipes implements IGuiHandler {
switch (GuiId.values()[id]) {
case PropolisPipeGUI:
PluginApiculture.beeInterface.getBreedingTracker(world, player.getGameProfile()).synchToPlayer(player);
BeeManager.beeRoot.getBreedingTracker(world, player.getGameProfile()).synchToPlayer(player);
return new ContainerPropolisPipe(player.inventory, (PipeItemsPropolis) getPipe(world, x, y, z));
default:
return null;
@@ -20,12 +20,12 @@ import net.minecraftforge.common.util.ForgeDirection;
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.ForestryAPI;
import forestry.api.genetics.IAllele;
import forestry.core.network.GuiId;
import forestry.core.proxy.Proxies;
import forestry.plugins.PluginApiculture;
import buildcraft.api.core.IIconProvider;
import buildcraft.transport.BlockGenericPipe;
@@ -104,7 +104,7 @@ public class PipeItemsPropolis extends Pipe<PipeTransportItems> {
IBee bee = null;
if (type != EnumFilterType.ITEM) {
bee = PluginApiculture.beeInterface.getMember(event.item.getItemStack());
bee = BeeManager.beeRoot.getMember(event.item.getItemStack());
}
// Filtered outputs
Loaded 100 of 108 files, more files were not shown because too many files have changed in this diff. Show more