mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-27 23:46:05 +00:00
port to forestry 4.2
This commit is contained in:
1 parent
dbc5c1a564
commit
f969f63b66
3697 files changed
+78372
No files matched your search
@@ -0,0 +1,143 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import java.util.TreeSet;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.api.genetics.IMutation;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.Binnie;
|
||||
|
||||
class BeeBreedingSystem extends BreedingSystem
|
||||
{
|
||||
public BeeBreedingSystem() {
|
||||
this.iconUndiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/undiscoveredBee");
|
||||
this.iconDiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/discoveredBee");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(final IMutation mutation, final EntityPlayer player, final IAllele species1, final IAllele species2) {
|
||||
return ((IBeeMutation) mutation).
|
||||
getChance(new VirtualBeeHousing(player),
|
||||
(IAlleleBeeSpecies) species1,
|
||||
(IAlleleBeeSpecies) species2,
|
||||
(IBeeGenome) this.getSpeciesRoot().
|
||||
templateAsGenome(this.getSpeciesRoot().getTemplate(species1.getUID())),
|
||||
(IBeeGenome) this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(species2.getUID())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return Binnie.Genetics.getBeeRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return 16767232;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IBreedingTracker> getTrackerClass() {
|
||||
return IApiaristTracker.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (chromosome == EnumBeeChromosome.FERTILITY) {
|
||||
if (allele.getUID().contains("Low")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.low");
|
||||
}
|
||||
if (allele.getUID().contains("Normal")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.normal");
|
||||
}
|
||||
if (allele.getUID().contains("High")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.high");
|
||||
}
|
||||
if (allele.getUID().contains("Maximum")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.maximum");
|
||||
}
|
||||
}
|
||||
return super.getAlleleName(chromosome, allele);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDNAManipulable(final ItemStack member) {
|
||||
return ((IBeeRoot) this.getSpeciesRoot()).getType(member) == EnumBeeType.LARVAE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getActiveTypes() {
|
||||
return new int[] { EnumBeeType.DRONE.ordinal(), EnumBeeType.PRINCESS.ordinal(), EnumBeeType.QUEEN.ordinal(), EnumBeeType.LARVAE.ordinal() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExtraAlleles(final IChromosomeType chromosome, final TreeSet<IAllele> alleles) {
|
||||
switch ((EnumBeeChromosome) chromosome) {
|
||||
case FERTILITY: {
|
||||
for (final ForestryAllele.Fertility a : ForestryAllele.Fertility.values()) {
|
||||
alleles.add(a.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FLOWERING: {
|
||||
for (final ForestryAllele.Flowering a2 : ForestryAllele.Flowering.values()) {
|
||||
alleles.add(a2.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HUMIDITY_TOLERANCE:
|
||||
case TEMPERATURE_TOLERANCE: {
|
||||
for (final Tolerance a3 : Tolerance.values()) {
|
||||
alleles.add(a3.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LIFESPAN: {
|
||||
for (final ForestryAllele.Lifespan a4 : ForestryAllele.Lifespan.values()) {
|
||||
alleles.add(a4.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPEED: {
|
||||
for (final ForestryAllele.Speed a5 : ForestryAllele.Speed.values()) {
|
||||
alleles.add(a5.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TERRITORY: {
|
||||
for (final ForestryAllele.Territory a6 : ForestryAllele.Territory.values()) {
|
||||
alleles.add(a6.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NOCTURNAL:
|
||||
case CAVE_DWELLING:
|
||||
case TOLERANT_FLYER: {
|
||||
for (final ForestryAllele.Bool a7 : ForestryAllele.Bool.values()) {
|
||||
alleles.add(a7.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class BeeModifierLogic
|
||||
{
|
||||
private Map<EnumBeeModifier, Float[]> modifiers;
|
||||
private List<EnumBeeBooleanModifier> booleanModifiers;
|
||||
|
||||
public BeeModifierLogic() {
|
||||
this.modifiers = new HashMap<EnumBeeModifier, Float[]>();
|
||||
this.booleanModifiers = new ArrayList<EnumBeeBooleanModifier>();
|
||||
}
|
||||
|
||||
public float getModifier(final EnumBeeModifier modifier, final float currentModifier) {
|
||||
if (!this.modifiers.containsKey(modifier)) {
|
||||
return 1.0f;
|
||||
}
|
||||
final float mult = this.modifiers.get(modifier)[0];
|
||||
final float max = this.modifiers.get(modifier)[1];
|
||||
if (max >= 1.0f) {
|
||||
if (max <= currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
return Math.min(max / currentModifier, mult);
|
||||
}
|
||||
else {
|
||||
if (max >= currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
return Math.max(max / currentModifier, mult);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getModifier(final EnumBeeBooleanModifier modifier) {
|
||||
return this.booleanModifiers.contains(modifier);
|
||||
}
|
||||
|
||||
public void setModifier(final EnumBeeBooleanModifier modifier) {
|
||||
this.booleanModifiers.add(modifier);
|
||||
}
|
||||
|
||||
public void setModifier(final EnumBeeModifier modifier, final float mult, final float max) {
|
||||
this.modifiers.put(modifier, new Float[] { mult, max });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,494 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import forestry.api.genetics.IGenome;
|
||||
import java.util.TreeSet;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import forestry.api.genetics.IAlleleBoolean;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.world.World;
|
||||
import java.util.Set;
|
||||
import binnie.extrabees.genetics.ExtraBeeMutation;
|
||||
import java.util.LinkedHashSet;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import java.util.Collection;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import binnie.core.BinnieCore;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import binnie.Binnie;
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import java.util.List;
|
||||
import binnie.core.resource.BinnieIcon;
|
||||
|
||||
public abstract class BreedingSystem implements IItemStackRepresentitive
|
||||
{
|
||||
protected BinnieIcon iconUndiscovered;
|
||||
protected BinnieIcon iconDiscovered;
|
||||
private List<IClassification> allBranches;
|
||||
List<IAlleleSpecies> allActiveSpecies;
|
||||
private List<IAlleleSpecies> allSpecies;
|
||||
private List<IMutation> allMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> resultantMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> furtherMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> allResultantMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> allFurtherMutations;
|
||||
public float discoveredSpeciesPercentage;
|
||||
public int totalSpeciesCount;
|
||||
public int discoveredSpeciesCount;
|
||||
public int totalSecretCount;
|
||||
public int discoveredSecretCount;
|
||||
public float discoveredBranchPercentage;
|
||||
public int totalBranchCount;
|
||||
public int discoveredBranchCount;
|
||||
private int totalSecretBranchCount;
|
||||
private int discoveredSecretBranchCount;
|
||||
String currentEpithet;
|
||||
|
||||
public BreedingSystem() {
|
||||
this.allBranches = new ArrayList<IClassification>();
|
||||
this.allActiveSpecies = new ArrayList<IAlleleSpecies>();
|
||||
this.allSpecies = new ArrayList<IAlleleSpecies>();
|
||||
this.allMutations = new ArrayList<IMutation>();
|
||||
this.resultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.furtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allResultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allFurtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
Binnie.Genetics.registerBreedingSystem(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
public String getChromosomeName(final IChromosomeType chromo) {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".chromosome." + chromo.getName());
|
||||
}
|
||||
|
||||
public String getChromosomeShortName(final IChromosomeType chromo) {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".chromosome." + chromo.getName() + ".short");
|
||||
}
|
||||
|
||||
public final String getEpitome(final float discoveredPercentage) {
|
||||
int i = 0;
|
||||
if (discoveredPercentage == 1.0f) {
|
||||
i = 6;
|
||||
}
|
||||
else if (discoveredPercentage < 0.1f) {
|
||||
i = 0;
|
||||
}
|
||||
else if (discoveredPercentage < 0.3f) {
|
||||
i = 1;
|
||||
}
|
||||
else if (discoveredPercentage < 0.5f) {
|
||||
i = 2;
|
||||
}
|
||||
else if (discoveredPercentage < 0.7f) {
|
||||
i = 3;
|
||||
}
|
||||
else if (discoveredPercentage < 0.9f) {
|
||||
i = 4;
|
||||
}
|
||||
else if (discoveredPercentage < 1.0f) {
|
||||
i = 5;
|
||||
}
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".epitome." + i);
|
||||
}
|
||||
|
||||
public abstract ISpeciesRoot getSpeciesRoot();
|
||||
|
||||
public final List<IClassification> getAllBranches() {
|
||||
return this.allBranches;
|
||||
}
|
||||
|
||||
public final Collection<IAlleleSpecies> getAllSpecies() {
|
||||
return this.allActiveSpecies;
|
||||
}
|
||||
|
||||
public final Collection<IMutation> getAllMutations() {
|
||||
return this.allMutations;
|
||||
}
|
||||
|
||||
public void calculateArrays() {
|
||||
final Collection<IAllele> allAlleles = AlleleManager.alleleRegistry.getRegisteredAlleles().values();
|
||||
this.resultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.furtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allResultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allFurtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allActiveSpecies = new ArrayList<IAlleleSpecies>();
|
||||
this.allSpecies = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAllele species : allAlleles) {
|
||||
if (this.getSpeciesRoot().getTemplate(species.getUID()) != null) {
|
||||
this.resultantMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.furtherMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.allResultantMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.allFurtherMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.allSpecies.add((IAlleleSpecies) species);
|
||||
if (this.isBlacklisted(species) || species.getUID().contains("speciesBotAlfheim")) {
|
||||
continue;
|
||||
}
|
||||
this.allActiveSpecies.add((IAlleleSpecies) species);
|
||||
}
|
||||
}
|
||||
this.allMutations = new ArrayList<IMutation>();
|
||||
final Collection<IClassification> allRegBranches = AlleleManager.alleleRegistry.getRegisteredClassifications().values();
|
||||
this.allBranches = new ArrayList<IClassification>();
|
||||
for (final IClassification branch : allRegBranches) {
|
||||
if (branch.getMemberSpecies().length > 0 && this.getSpeciesRoot().getTemplate(branch.getMemberSpecies()[0].getUID()) != null) {
|
||||
boolean possible = false;
|
||||
for (final IAlleleSpecies species2 : branch.getMemberSpecies()) {
|
||||
if (this.allActiveSpecies.contains(species2)) {
|
||||
possible = true;
|
||||
}
|
||||
}
|
||||
if (!possible) {
|
||||
continue;
|
||||
}
|
||||
this.allBranches.add(branch);
|
||||
}
|
||||
}
|
||||
if (this.getSpeciesRoot().getMutations(false) != null) {
|
||||
final Set<IMutation> mutations = new LinkedHashSet<IMutation>();
|
||||
mutations.addAll(this.getSpeciesRoot().getMutations(false));
|
||||
if (this == Binnie.Genetics.beeBreedingSystem) {
|
||||
mutations.addAll(ExtraBeeMutation.mutations);
|
||||
}
|
||||
for (final IMutation mutation : mutations) {
|
||||
this.allMutations.add(mutation);
|
||||
final Set<IAlleleSpecies> participatingSpecies = new LinkedHashSet<IAlleleSpecies>();
|
||||
if (mutation.getAllele0() instanceof IAlleleSpecies) {
|
||||
participatingSpecies.add(mutation.getAllele0());
|
||||
}
|
||||
if (mutation.getAllele1() instanceof IAlleleSpecies) {
|
||||
participatingSpecies.add(mutation.getAllele1());
|
||||
}
|
||||
for (final IAlleleSpecies species3 : participatingSpecies) {
|
||||
this.allFurtherMutations.get(species3).add(mutation);
|
||||
if (this.allActiveSpecies.contains(species3)) {
|
||||
this.furtherMutations.get(species3).add(mutation);
|
||||
}
|
||||
}
|
||||
if (this.resultantMutations.containsKey(mutation.getTemplate()[0])) {
|
||||
this.allResultantMutations.get(mutation.getTemplate()[0]).add(mutation);
|
||||
this.resultantMutations.get(mutation.getTemplate()[0]).add(mutation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean isBlacklisted(final IAllele allele) {
|
||||
return AlleleManager.alleleRegistry.isBlacklisted(allele.getUID());
|
||||
}
|
||||
|
||||
public final List<IMutation> getResultantMutations(final IAlleleSpecies species, final boolean includeInactive) {
|
||||
if (this.resultantMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return includeInactive ? this.allResultantMutations.get(species) : this.resultantMutations.get(species);
|
||||
}
|
||||
|
||||
public final List<IMutation> getResultantMutations(final IAlleleSpecies species) {
|
||||
if (this.resultantMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return this.resultantMutations.get(species);
|
||||
}
|
||||
|
||||
public final List<IMutation> getFurtherMutations(final IAlleleSpecies species, final boolean includeInactive) {
|
||||
if (this.furtherMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return includeInactive ? this.allFurtherMutations.get(species) : this.furtherMutations.get(species);
|
||||
}
|
||||
|
||||
public final List<IMutation> getFurtherMutations(final IAlleleSpecies species) {
|
||||
if (this.furtherMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return this.furtherMutations.get(species);
|
||||
}
|
||||
|
||||
public final boolean isMutationDiscovered(final IMutation mutation, final World world, final GameProfile name) {
|
||||
return this.isMutationDiscovered(mutation, this.getSpeciesRoot().getBreedingTracker(world, name));
|
||||
}
|
||||
|
||||
public final boolean isMutationDiscovered(final IMutation mutation, final IBreedingTracker tracker) {
|
||||
return tracker == null || tracker.isDiscovered(mutation);
|
||||
}
|
||||
|
||||
public final boolean isSpeciesDiscovered(final IAlleleSpecies species, final World world, final GameProfile name) {
|
||||
return this.isSpeciesDiscovered(species, this.getSpeciesRoot().getBreedingTracker(world, name));
|
||||
}
|
||||
|
||||
public final boolean isSpeciesDiscovered(final IAlleleSpecies species, final IBreedingTracker tracker) {
|
||||
return tracker == null || tracker.isDiscovered(species);
|
||||
}
|
||||
|
||||
public final boolean isSecret(final IAlleleSpecies species) {
|
||||
return !species.isCounted();
|
||||
}
|
||||
|
||||
public final boolean isSecret(final IClassification branch) {
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (!this.isSecret(species)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public final Collection<IClassification> getDiscoveredBranches(final World world, final GameProfile player) {
|
||||
final List<IClassification> branches = new ArrayList<IClassification>();
|
||||
for (final IClassification branch : this.getAllBranches()) {
|
||||
boolean discovered = false;
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, world, player)) {
|
||||
discovered = true;
|
||||
}
|
||||
}
|
||||
if (discovered) {
|
||||
branches.add(branch);
|
||||
}
|
||||
}
|
||||
return branches;
|
||||
}
|
||||
|
||||
public final Collection<IClassification> getDiscoveredBranches(final IBreedingTracker tracker) {
|
||||
final List<IClassification> branches = new ArrayList<IClassification>();
|
||||
for (final IClassification branch : this.getAllBranches()) {
|
||||
boolean discovered = false;
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, tracker)) {
|
||||
discovered = true;
|
||||
}
|
||||
}
|
||||
if (discovered) {
|
||||
branches.add(branch);
|
||||
}
|
||||
}
|
||||
return branches;
|
||||
}
|
||||
|
||||
public final Collection<IAlleleSpecies> getDiscoveredSpecies(final World world, final GameProfile player) {
|
||||
final List<IAlleleSpecies> speciesList = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAlleleSpecies species : this.getAllSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, world, player)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
|
||||
public final Collection<IAlleleSpecies> getDiscoveredSpecies(final IBreedingTracker tracker) {
|
||||
final List<IAlleleSpecies> speciesList = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAlleleSpecies species : this.getAllSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, tracker)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
|
||||
public final List<IMutation> getDiscoveredMutations(final World world, final GameProfile player) {
|
||||
final List<IMutation> speciesList = new ArrayList<IMutation>();
|
||||
for (final IMutation species : this.getAllMutations()) {
|
||||
if (this.isMutationDiscovered(species, world, player)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
|
||||
public final List<IMutation> getDiscoveredMutations(final IBreedingTracker tracker) {
|
||||
final List<IMutation> speciesList = new ArrayList<IMutation>();
|
||||
for (final IMutation species : this.getAllMutations()) {
|
||||
if (this.isMutationDiscovered(species, tracker)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
|
||||
public final int getDiscoveredBranchMembers(final IClassification branch, final IBreedingTracker tracker) {
|
||||
int discoveredSpecies = 0;
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, tracker)) {
|
||||
++discoveredSpecies;
|
||||
}
|
||||
}
|
||||
return discoveredSpecies;
|
||||
}
|
||||
|
||||
public IIcon getUndiscoveredIcon() {
|
||||
return this.iconUndiscovered.getIcon();
|
||||
}
|
||||
|
||||
public IIcon getDiscoveredIcon() {
|
||||
return this.iconDiscovered.getIcon();
|
||||
}
|
||||
|
||||
public abstract float getChance(final IMutation p0, final EntityPlayer p1, final IAllele p2, final IAllele p3);
|
||||
|
||||
public abstract Class<? extends IBreedingTracker> getTrackerClass();
|
||||
|
||||
@SubscribeEvent
|
||||
public final void onSyncBreedingTracker(final ForestryEvent.SyncedBreedingTracker event) {
|
||||
final IBreedingTracker tracker = event.tracker;
|
||||
if (!this.getTrackerClass().isInstance(tracker)) {
|
||||
return;
|
||||
}
|
||||
this.syncTracker(tracker);
|
||||
}
|
||||
|
||||
public final void syncTracker(final IBreedingTracker tracker) {
|
||||
this.discoveredSpeciesPercentage = 0.0f;
|
||||
this.totalSpeciesCount = 0;
|
||||
this.discoveredSpeciesCount = 0;
|
||||
this.totalSecretCount = 0;
|
||||
this.discoveredSecretCount = 0;
|
||||
final Collection<IAlleleSpecies> discoveredSpecies = this.getDiscoveredSpecies(tracker);
|
||||
final Collection<IAlleleSpecies> allSpecies = this.getAllSpecies();
|
||||
for (final IAlleleSpecies species : allSpecies) {
|
||||
if (!this.isSecret(species)) {
|
||||
++this.totalSpeciesCount;
|
||||
if (!this.isSpeciesDiscovered(species, tracker)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredSpeciesCount;
|
||||
}
|
||||
else {
|
||||
++this.totalSecretCount;
|
||||
if (!this.isSpeciesDiscovered(species, tracker)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredSecretCount;
|
||||
}
|
||||
}
|
||||
this.discoveredBranchPercentage = 0.0f;
|
||||
this.totalBranchCount = 0;
|
||||
this.discoveredBranchCount = 0;
|
||||
final Collection<IClassification> discoveredBranches = this.getDiscoveredBranches(tracker);
|
||||
final Collection<IClassification> allBranches = this.getAllBranches();
|
||||
for (final IClassification branch : allBranches) {
|
||||
if (!this.isSecret(branch)) {
|
||||
++this.totalBranchCount;
|
||||
if (!discoveredBranches.contains(branch)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredBranchCount;
|
||||
}
|
||||
else {
|
||||
++this.totalSecretBranchCount;
|
||||
if (!discoveredBranches.contains(branch)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredSecretBranchCount;
|
||||
}
|
||||
}
|
||||
this.discoveredSpeciesPercentage = this.discoveredSpeciesCount / this.totalSpeciesCount;
|
||||
this.discoveredBranchPercentage = this.discoveredBranchCount / this.totalBranchCount;
|
||||
final String epithet = this.getEpitome();
|
||||
this.onSyncBreedingTracker(tracker);
|
||||
}
|
||||
|
||||
public void onSyncBreedingTracker(final IBreedingTracker tracker) {
|
||||
}
|
||||
|
||||
public String getEpitome() {
|
||||
return this.getEpitome(this.discoveredSpeciesPercentage);
|
||||
}
|
||||
|
||||
public final String getDescriptor() {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".descriptor");
|
||||
}
|
||||
|
||||
public final String getIdent() {
|
||||
return this.getSpeciesRoot().getUID();
|
||||
}
|
||||
|
||||
public final IChromosomeType getChromosome(final int i) {
|
||||
for (final IChromosomeType chromosome : this.getSpeciesRoot().getKaryotype()) {
|
||||
if (i == chromosome.ordinal()) {
|
||||
return chromosome;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract int getColour();
|
||||
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (allele instanceof IAlleleBoolean) {
|
||||
return ((IAlleleBoolean) allele).getValue() ? Binnie.Language.localise(BinnieCore.instance, "allele.true") : Binnie.Language.localise(BinnieCore.instance, "allele.false");
|
||||
}
|
||||
if (allele.getName() == "for.gui.maximum") {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.maximum");
|
||||
}
|
||||
return allele.getName();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".shortName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStackRepresentitive() {
|
||||
final IIndividual first = this.getSpeciesRoot().getIndividualTemplates().get(0);
|
||||
return this.getSpeciesRoot().getMemberStack(first, this.getDefaultType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
public abstract boolean isDNAManipulable(final ItemStack p0);
|
||||
|
||||
public IIndividual getConversion(final ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final IIndividual getDefaultIndividual() {
|
||||
return this.getSpeciesRoot().templateAsIndividual(this.getSpeciesRoot().getDefaultTemplate());
|
||||
}
|
||||
|
||||
public final int getDefaultType() {
|
||||
return this.getActiveTypes()[0];
|
||||
}
|
||||
|
||||
public abstract int[] getActiveTypes();
|
||||
|
||||
public abstract void addExtraAlleles(final IChromosomeType p0, final TreeSet<IAllele> p1);
|
||||
|
||||
public ItemStack getConversionStack(final ItemStack stack) {
|
||||
return this.getSpeciesRoot().getMemberStack(this.getConversion(stack), this.getDefaultType());
|
||||
}
|
||||
|
||||
public final Collection<IChromosomeType> getActiveKaryotype() {
|
||||
return Binnie.Genetics.getActiveChromosomes(this.getSpeciesRoot());
|
||||
}
|
||||
|
||||
public ItemStack getDefaultMember(final String uid) {
|
||||
return this.getSpeciesRoot().getMemberStack(this.getIndividual(uid), this.getDefaultType());
|
||||
}
|
||||
|
||||
public IIndividual getIndividual(final String uid) {
|
||||
return this.getSpeciesRoot().templateAsIndividual(this.getSpeciesRoot().getTemplate(uid));
|
||||
}
|
||||
|
||||
public IGenome getGenome(final String uid) {
|
||||
return this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(uid));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
public enum EnumBeeBooleanModifier
|
||||
{
|
||||
Sealed,
|
||||
SelfLighted,
|
||||
SunlightStimulated,
|
||||
Hellish;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.Binnie;
|
||||
|
||||
public enum EnumBeeModifier
|
||||
{
|
||||
Territory,
|
||||
Mutation,
|
||||
Lifespan,
|
||||
Production,
|
||||
Flowering,
|
||||
GeneticDecay;
|
||||
|
||||
public String getName() {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "beemodifier." + this.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import java.util.TreeSet;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import binnie.botany.api.IBotanistTracker;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.Binnie;
|
||||
|
||||
class FlowerBreedingSystem extends BreedingSystem
|
||||
{
|
||||
public FlowerBreedingSystem() {
|
||||
this.iconUndiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/undiscoveredBee");
|
||||
this.iconDiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/discoveredBee");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(final IMutation mutation, final EntityPlayer player, final IAllele species1, final IAllele species2) {
|
||||
return ((IFlowerMutation) mutation).getBaseChance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return Binnie.Genetics.getFlowerRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return 14563127;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IBreedingTracker> getTrackerClass() {
|
||||
return IBotanistTracker.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (chromosome == EnumFlowerChromosome.FERTILITY) {
|
||||
if (allele.getUID().contains("Low")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.low");
|
||||
}
|
||||
if (allele.getUID().contains("Normal")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.normal");
|
||||
}
|
||||
if (allele.getUID().contains("High")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.high");
|
||||
}
|
||||
if (allele.getUID().contains("Maximum")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.maximum");
|
||||
}
|
||||
}
|
||||
return super.getAlleleName(chromosome, allele);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDNAManipulable(final ItemStack member) {
|
||||
return ((IFlowerRoot) this.getSpeciesRoot()).getStageType(member) == EnumFlowerStage.POLLEN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getConversion(final ItemStack stack) {
|
||||
return BotanyCore.getFlowerRoot().getConversion(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getActiveTypes() {
|
||||
return new int[] { EnumFlowerStage.FLOWER.ordinal(), EnumFlowerStage.POLLEN.ordinal(), EnumFlowerStage.SEED.ordinal() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExtraAlleles(final IChromosomeType chromosome, final TreeSet<IAllele> alleles) {
|
||||
switch ((EnumFlowerChromosome) chromosome) {
|
||||
case FERTILITY: {
|
||||
for (final ForestryAllele.Fertility a : ForestryAllele.Fertility.values()) {
|
||||
alleles.add(a.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LIFESPAN: {
|
||||
for (final ForestryAllele.Lifespan a2 : ForestryAllele.Lifespan.values()) {
|
||||
alleles.add(a2.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HUMIDITY_TOLERANCE:
|
||||
case PH_TOLERANCE:
|
||||
case TEMPERATURE_TOLERANCE: {
|
||||
for (final Tolerance a3 : Tolerance.values()) {
|
||||
alleles.add(a3.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PRIMARY:
|
||||
case SECONDARY:
|
||||
case STEM: {
|
||||
for (final EnumFlowerColor a4 : EnumFlowerColor.values()) {
|
||||
alleles.add(a4.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SAPPINESS: {
|
||||
for (final ForestryAllele.Sappiness a5 : ForestryAllele.Sappiness.values()) {
|
||||
alleles.add(a5.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TERRITORY: {
|
||||
for (final ForestryAllele.Territory a6 : ForestryAllele.Territory.values()) {
|
||||
alleles.add(a6.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import binnie.Binnie;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public class ForestryAllele
|
||||
{
|
||||
public enum Lifespan
|
||||
{
|
||||
Shortest,
|
||||
Shorter,
|
||||
Short,
|
||||
Shortened,
|
||||
Normal,
|
||||
Elongated,
|
||||
Long,
|
||||
Longer,
|
||||
Longest;
|
||||
|
||||
public IAllele getAllele() {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry.lifespan" + this.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public enum Speed
|
||||
{
|
||||
Slowest,
|
||||
Slower,
|
||||
Slow,
|
||||
Norm,
|
||||
Fast,
|
||||
Faster,
|
||||
Fastest;
|
||||
|
||||
public IAllele getAllele() {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry.speed" + this.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public enum Fertility
|
||||
{
|
||||
Low,
|
||||
Normal,
|
||||
High,
|
||||
Maximum;
|
||||
|
||||
public IAllele getAllele() {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry.fertility" + this.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public enum Flowering
|
||||
{
|
||||
Slowest,
|
||||
Slower,
|
||||
Slow,
|
||||
Average,
|
||||
Fast,
|
||||
Faster,
|
||||
Fastest,
|
||||
Maximum;
|
||||
|
||||
public IAllele getAllele() {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry.flowering" + this.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public enum Territory
|
||||
{
|
||||
Default,
|
||||
Large,
|
||||
Larger,
|
||||
Largest;
|
||||
|
||||
public IAllele getAllele() {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry.territory" + this.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public enum Sappiness
|
||||
{
|
||||
Lowest,
|
||||
Lower,
|
||||
Low,
|
||||
Average,
|
||||
High,
|
||||
Higher,
|
||||
Highest;
|
||||
|
||||
public IAllele getAllele() {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry.sappiness" + this.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public enum TreeHeight
|
||||
{
|
||||
Smallest,
|
||||
Smaller,
|
||||
Small,
|
||||
Average,
|
||||
Large,
|
||||
Larger,
|
||||
Largest,
|
||||
Gigantic;
|
||||
|
||||
public IAllele getAllele() {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry.height" + ((this == TreeHeight.Average) ? "Max10" : this.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
public enum Size
|
||||
{
|
||||
Smallest,
|
||||
Smaller,
|
||||
Small,
|
||||
Average,
|
||||
Large,
|
||||
Larger,
|
||||
Largest;
|
||||
|
||||
public IAllele getAllele() {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry.size" + this.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public enum Saplings
|
||||
{
|
||||
Lowest,
|
||||
Lower,
|
||||
Low,
|
||||
Average,
|
||||
High,
|
||||
Higher,
|
||||
Highest;
|
||||
|
||||
public IAllele getAllele() {
|
||||
String s = this.toString();
|
||||
if (this == Saplings.Average) {
|
||||
s = "Default";
|
||||
}
|
||||
if (this == Saplings.High) {
|
||||
s = "Double";
|
||||
}
|
||||
if (this == Saplings.Higher) {
|
||||
s = "Triple";
|
||||
}
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry.saplings" + s);
|
||||
}
|
||||
}
|
||||
|
||||
public enum Yield
|
||||
{
|
||||
Lowest,
|
||||
Lower,
|
||||
Low,
|
||||
Average,
|
||||
High,
|
||||
Higher,
|
||||
Highest;
|
||||
|
||||
public IAllele getAllele() {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry.yield" + ((this == Yield.Average) ? "Default" : this.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
public enum Maturation
|
||||
{
|
||||
Slowest,
|
||||
Slower,
|
||||
Slow,
|
||||
Average,
|
||||
Fast,
|
||||
Faster,
|
||||
Fastest;
|
||||
|
||||
public IAllele getAllele() {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry.maturation" + this.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public enum Bool
|
||||
{
|
||||
True,
|
||||
False;
|
||||
|
||||
public IAllele getAllele() {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry.bool" + this.toString());
|
||||
}
|
||||
|
||||
public static IAllele get(final boolean bool) {
|
||||
return (bool ? Bool.True : Bool.False).getAllele();
|
||||
}
|
||||
}
|
||||
|
||||
public enum Growth
|
||||
{
|
||||
Tropical;
|
||||
|
||||
public IAllele getAllele() {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry.growth" + this.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public enum Int
|
||||
{
|
||||
Int1,
|
||||
Int2,
|
||||
Int3,
|
||||
Int4,
|
||||
Int5,
|
||||
Int6,
|
||||
Int7,
|
||||
Int8,
|
||||
Int9,
|
||||
Int10;
|
||||
|
||||
public IAllele getAllele() {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry.i" + (this.ordinal() + 1) + "d");
|
||||
}
|
||||
}
|
||||
|
||||
public enum BeeSpecies
|
||||
{
|
||||
Modest,
|
||||
Noble,
|
||||
Forest,
|
||||
Rural,
|
||||
Marshy,
|
||||
Sinister,
|
||||
Tropical,
|
||||
Wintry,
|
||||
Merry,
|
||||
Austere,
|
||||
Imperial,
|
||||
Ended,
|
||||
Meadows,
|
||||
Common,
|
||||
Frugal,
|
||||
Unweary,
|
||||
Diligent,
|
||||
Majestic,
|
||||
Cultivated,
|
||||
Industrious,
|
||||
Valiant,
|
||||
Secluded,
|
||||
Hermitic,
|
||||
Spectral,
|
||||
Exotic,
|
||||
Fiendish,
|
||||
Monastic,
|
||||
Steadfast,
|
||||
Miry,
|
||||
Farmerly,
|
||||
Boggy,
|
||||
Demonic;
|
||||
|
||||
public IAlleleBeeSpecies getAllele() {
|
||||
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele("forestry.species" + this.toString());
|
||||
}
|
||||
|
||||
public IAllele[] getTemplate() {
|
||||
return Binnie.Genetics.getBeeRoot().getTemplate(this.getAllele().getUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import binnie.Binnie;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import binnie.genetics.api.IGene;
|
||||
import forestry.api.core.INBTTagable;
|
||||
|
||||
public class Gene implements INBTTagable, IGene
|
||||
{
|
||||
private IAllele allele;
|
||||
private IChromosomeType chromosome;
|
||||
private ISpeciesRoot root;
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return this.root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getAlleleName();
|
||||
}
|
||||
|
||||
public Gene(final IAllele allele, final IChromosomeType chromosome, final ISpeciesRoot root) {
|
||||
this.allele = allele;
|
||||
this.chromosome = chromosome;
|
||||
this.root = root;
|
||||
}
|
||||
|
||||
public Gene(final NBTTagCompound nbt) {
|
||||
this.readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound nbt) {
|
||||
this.allele = AlleleManager.alleleRegistry.getAllele(nbt.getString("allele"));
|
||||
this.root = AlleleManager.alleleRegistry.getSpeciesRoot(nbt.getString("root"));
|
||||
final int chromoID = nbt.getByte("chromo");
|
||||
if (this.root != null && chromoID >= 0 && chromoID < this.root.getKaryotype().length) {
|
||||
this.chromosome = this.root.getKaryotype()[chromoID];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final NBTTagCompound nbt) {
|
||||
nbt.setString("allele", this.allele.getUID());
|
||||
nbt.setString("root", this.root.getUID());
|
||||
nbt.setByte("chromo", (byte) this.chromosome.ordinal());
|
||||
}
|
||||
|
||||
public boolean isCorrupted() {
|
||||
return this.allele == null || this.chromosome == null || this.root == null;
|
||||
}
|
||||
|
||||
public static Gene create(final NBTTagCompound nbt) {
|
||||
final Gene gene = new Gene(nbt);
|
||||
return gene.isCorrupted() ? null : gene;
|
||||
}
|
||||
|
||||
public static Gene create(final IAllele allele, final IChromosomeType chromosome, final ISpeciesRoot root) {
|
||||
final Gene gene = new Gene(allele, chromosome, root);
|
||||
return gene.isCorrupted() ? null : gene;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTTagCompound() {
|
||||
final NBTTagCompound nbt = new NBTTagCompound();
|
||||
this.writeToNBT(nbt);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Binnie.Genetics.getSystem(this.root).getAlleleName(this.chromosome, this.allele);
|
||||
}
|
||||
|
||||
public BreedingSystem getSystem() {
|
||||
return Binnie.Genetics.getSystem(this.root);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChromosomeType getChromosome() {
|
||||
return this.chromosome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele getAllele() {
|
||||
return this.allele;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (!(obj instanceof Gene)) {
|
||||
return false;
|
||||
}
|
||||
final Gene g = (Gene) obj;
|
||||
return this.allele == g.allele && this.chromosome.ordinal() == g.chromosome.ordinal() && this.root == g.root;
|
||||
}
|
||||
|
||||
public String getAlleleName() {
|
||||
return this.getSystem().getAlleleName(this.chromosome, this.allele);
|
||||
}
|
||||
|
||||
public String getChromosomeName() {
|
||||
return this.getSystem().getChromosomeName(this.chromosome);
|
||||
}
|
||||
|
||||
public String getShortChromosomeName() {
|
||||
return this.getSystem().getChromosomeShortName(this.chromosome);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public interface IAlleleProvider
|
||||
{
|
||||
IAllele getAllele();
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import forestry.api.genetics.IClassification;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.Binnie;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
interface IBreedingMessage
|
||||
{
|
||||
String getTitle();
|
||||
|
||||
String getBody();
|
||||
|
||||
ItemStack getIcon();
|
||||
|
||||
public static class MessageSpeciesDiscovered implements IBreedingMessage
|
||||
{
|
||||
IAlleleSpecies species;
|
||||
ItemStack stack;
|
||||
|
||||
public MessageSpeciesDiscovered(final IAlleleSpecies species) {
|
||||
this.species = species;
|
||||
ISpeciesRoot root = null;
|
||||
for (final ISpeciesRoot sRoot : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
if (sRoot.getKaryotype()[0].getAlleleClass().isInstance(species)) {
|
||||
root = sRoot;
|
||||
}
|
||||
}
|
||||
if (root != null) {
|
||||
this.stack = root.getMemberStack(root.templateAsIndividual(root.getTemplate(species.getUID())), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "gui.breedingmessage.species");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBody() {
|
||||
return this.species.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIcon() {
|
||||
return this.stack;
|
||||
}
|
||||
}
|
||||
|
||||
public static class BranchDiscovered implements IBreedingMessage
|
||||
{
|
||||
IAlleleSpecies species;
|
||||
IClassification classification;
|
||||
ItemStack stack;
|
||||
|
||||
public BranchDiscovered(final IAlleleSpecies species, final IClassification classification) {
|
||||
this.species = species;
|
||||
this.classification = classification;
|
||||
ISpeciesRoot root = null;
|
||||
for (final ISpeciesRoot sRoot : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
if (sRoot.getKaryotype()[0].getAlleleClass().isInstance(species)) {
|
||||
root = sRoot;
|
||||
}
|
||||
}
|
||||
if (root != null) {
|
||||
this.stack = root.getMemberStack(root.templateAsIndividual(root.getTemplate(species.getUID())), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "gui.breedingmessage.branch");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBody() {
|
||||
return this.classification.getScientific();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIcon() {
|
||||
return this.stack;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EpithetGained implements IBreedingMessage
|
||||
{
|
||||
String epithet;
|
||||
ItemStack stack;
|
||||
|
||||
public EpithetGained(final String epithet, final ISpeciesRoot root) {
|
||||
this.epithet = epithet;
|
||||
this.stack = root.getMemberStack(root.templateAsIndividual(root.getDefaultTemplate()), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "gui.breedingmessage.epithet");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBody() {
|
||||
return this.epithet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIcon() {
|
||||
return this.stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IItemStackRepresentitive
|
||||
{
|
||||
ItemStack getItemStackRepresentitive();
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import binnie.botany.genetics.AlleleColor;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import java.util.Comparator;
|
||||
import java.util.TreeSet;
|
||||
import binnie.Binnie;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.Collection;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import forestry.api.lepidopterology.IButterflyRoot;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.arboriculture.ITreeRoot;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import binnie.core.BinnieCore;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import java.util.List;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import java.util.Map;
|
||||
import binnie.core.ManagerBase;
|
||||
|
||||
public class ManagerGenetics extends ManagerBase
|
||||
{
|
||||
public BreedingSystem beeBreedingSystem;
|
||||
public BreedingSystem treeBreedingSystem;
|
||||
public BreedingSystem mothBreedingSystem;
|
||||
public BreedingSystem flowerBreedingSystem;
|
||||
private final Map<ISpeciesRoot, BreedingSystem> BREEDING_SYSTEMS;
|
||||
private List<IChromosomeType> invalidChromosomeTypes;
|
||||
private Map<ISpeciesRoot, Map<IChromosomeType, List<IAllele>>> chromosomeArray;
|
||||
|
||||
public ManagerGenetics() {
|
||||
this.BREEDING_SYSTEMS = new LinkedHashMap<ISpeciesRoot, BreedingSystem>();
|
||||
this.invalidChromosomeTypes = new ArrayList<IChromosomeType>();
|
||||
this.chromosomeArray = new LinkedHashMap<ISpeciesRoot, Map<IChromosomeType, List<IAllele>>>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
if (BinnieCore.isApicultureActive()) {
|
||||
this.beeBreedingSystem = new BeeBreedingSystem();
|
||||
}
|
||||
if (BinnieCore.isArboricultureActive()) {
|
||||
this.treeBreedingSystem = new TreeBreedingSystem();
|
||||
}
|
||||
if (BinnieCore.isLepidopteryActive()) {
|
||||
this.mothBreedingSystem = new MothBreedingSystem();
|
||||
}
|
||||
if (BinnieCore.isBotanyActive()) {
|
||||
this.flowerBreedingSystem = new FlowerBreedingSystem();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
this.refreshData();
|
||||
}
|
||||
|
||||
public boolean isSpeciesDiscovered(final IAlleleSpecies species, final World world, final boolean nei) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ITreeRoot getTreeRoot() {
|
||||
return (ITreeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees");
|
||||
}
|
||||
|
||||
public IBeeRoot getBeeRoot() {
|
||||
return (IBeeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
|
||||
}
|
||||
|
||||
public IButterflyRoot getButterflyRoot() {
|
||||
return (IButterflyRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootButterflies");
|
||||
}
|
||||
|
||||
public IFlowerRoot getFlowerRoot() {
|
||||
return (IFlowerRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers");
|
||||
}
|
||||
|
||||
public BreedingSystem getSystem(final String string) {
|
||||
for (final BreedingSystem system : this.BREEDING_SYSTEMS.values()) {
|
||||
if (system.getIdent().equals(string)) {
|
||||
return system;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BreedingSystem getSystem(final ISpeciesRoot root) {
|
||||
return this.getSystem(root.getUID());
|
||||
}
|
||||
|
||||
public ISpeciesRoot getSpeciesRoot(final IAlleleSpecies species) {
|
||||
for (final ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
if (root.getKaryotype()[0].getAlleleClass().isInstance(species)) {
|
||||
return root;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IAllele getToleranceAllele(final EnumTolerance tol) {
|
||||
return AlleleManager.alleleRegistry.getAllele(Tolerance.values()[tol.ordinal()].getUID());
|
||||
}
|
||||
|
||||
public int[] getTolerance(final EnumTolerance tol) {
|
||||
return Tolerance.values()[tol.ordinal()].getBounds();
|
||||
}
|
||||
|
||||
public Collection<BreedingSystem> getActiveSystems() {
|
||||
return this.BREEDING_SYSTEMS.values();
|
||||
}
|
||||
|
||||
public void registerBreedingSystem(final BreedingSystem system) {
|
||||
this.BREEDING_SYSTEMS.put(system.getSpeciesRoot(), system);
|
||||
}
|
||||
|
||||
public BreedingSystem getConversionSystem(final ItemStack stack) {
|
||||
for (final BreedingSystem system : this.getActiveSystems()) {
|
||||
if (system.getConversion(stack) != null) {
|
||||
return system;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack getConversionStack(final ItemStack stack) {
|
||||
final BreedingSystem system = this.getConversionSystem(stack);
|
||||
return (system == null) ? null : system.getConversionStack(stack);
|
||||
}
|
||||
|
||||
public IIndividual getConversion(final ItemStack stack) {
|
||||
final BreedingSystem system = this.getConversionSystem(stack);
|
||||
return (system == null) ? null : system.getConversion(stack);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldLoad(final WorldEvent.Load event) {
|
||||
this.refreshData();
|
||||
}
|
||||
|
||||
private void refreshData() {
|
||||
this.loadAlleles();
|
||||
for (final BreedingSystem system : Binnie.Genetics.getActiveSystems()) {
|
||||
system.calculateArrays();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadAlleles() {
|
||||
this.invalidChromosomeTypes.clear();
|
||||
for (final ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
final BreedingSystem system = this.getSystem(root);
|
||||
final Map<IChromosomeType, List<IAllele>> chromosomeMap = new LinkedHashMap<IChromosomeType, List<IAllele>>();
|
||||
for (final IChromosomeType chromosome : root.getKaryotype()) {
|
||||
final TreeSet<IAllele> alleles = new TreeSet<IAllele>(new ComparatorAllele());
|
||||
for (final IIndividual individual : root.getIndividualTemplates()) {
|
||||
final IGenome genome = individual.getGenome();
|
||||
try {
|
||||
final IAllele a1 = genome.getActiveAllele(chromosome);
|
||||
final IAllele a2 = genome.getInactiveAllele(chromosome);
|
||||
if (chromosome.getAlleleClass().isInstance(a1)) {
|
||||
alleles.add(a1);
|
||||
}
|
||||
if (!chromosome.getAlleleClass().isInstance(a2)) {
|
||||
continue;
|
||||
}
|
||||
alleles.add(a2);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
system.addExtraAlleles(chromosome, alleles);
|
||||
if (alleles.size() == 0) {
|
||||
this.invalidChromosomeTypes.add(chromosome);
|
||||
}
|
||||
else {
|
||||
final List<IAllele> alleleList = new ArrayList<IAllele>();
|
||||
alleleList.addAll(alleles);
|
||||
chromosomeMap.put(chromosome, alleleList);
|
||||
}
|
||||
}
|
||||
this.chromosomeArray.put(root, chromosomeMap);
|
||||
}
|
||||
}
|
||||
|
||||
public Map<IChromosomeType, List<IAllele>> getChromosomeMap(final ISpeciesRoot root) {
|
||||
return this.chromosomeArray.get(root);
|
||||
}
|
||||
|
||||
public Collection<IChromosomeType> getActiveChromosomes(final ISpeciesRoot root) {
|
||||
return this.getChromosomeMap(root).keySet();
|
||||
}
|
||||
|
||||
public boolean isInvalidChromosome(final IChromosomeType type) {
|
||||
return this.invalidChromosomeTypes.contains(type);
|
||||
}
|
||||
|
||||
static class ComparatorAllele implements Comparator<IAllele>
|
||||
{
|
||||
@Override
|
||||
public int compare(final IAllele o1, final IAllele o2) {
|
||||
if (o1 == null || o2 == null) {
|
||||
throw new NullPointerException("Allele is null!");
|
||||
}
|
||||
if (o1 instanceof IAlleleFloat && o2 instanceof IAlleleFloat) {
|
||||
return Float.valueOf(((IAlleleFloat) o1).getValue()).compareTo(Float.valueOf(((IAlleleFloat) o2).getValue()));
|
||||
}
|
||||
if (o1 instanceof IAlleleInteger && o2 instanceof IAlleleInteger && !(o1 instanceof AlleleColor)) {
|
||||
return Integer.valueOf(((IAlleleInteger) o1).getValue()).compareTo(Integer.valueOf(((IAlleleInteger) o2).getValue()));
|
||||
}
|
||||
if (o1.getName() != null && o2.getName() != null) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
return o1.getUID().compareTo(o2.getUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import java.util.TreeSet;
|
||||
import forestry.api.lepidopterology.EnumFlutterType;
|
||||
import forestry.api.lepidopterology.IButterflyRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.core.BinnieCore;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.lepidopterology.EnumButterflyChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.lepidopterology.ILepidopteristTracker;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.Binnie;
|
||||
|
||||
class MothBreedingSystem extends BreedingSystem
|
||||
{
|
||||
public MothBreedingSystem() {
|
||||
this.iconUndiscovered = Binnie.Resource.getItemIcon(ExtraTrees.instance, "icon/undiscoveredMoth");
|
||||
this.iconDiscovered = Binnie.Resource.getItemIcon(ExtraTrees.instance, "icon/discoveredMoth");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(final IMutation mutation, final EntityPlayer player, final IAllele species1, final IAllele species2) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return Binnie.Genetics.getButterflyRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return 62194;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IBreedingTracker> getTrackerClass() {
|
||||
return ILepidopteristTracker.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (chromosome == EnumButterflyChromosome.METABOLISM) {
|
||||
final int metabolism = ((IAlleleInteger) allele).getValue();
|
||||
if (metabolism >= 19) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.metabolism.highest");
|
||||
}
|
||||
if (metabolism >= 16) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.metabolism.higher");
|
||||
}
|
||||
if (metabolism >= 13) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.metabolism.high");
|
||||
}
|
||||
if (metabolism >= 10) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.metabolism.normal");
|
||||
}
|
||||
if (metabolism >= 7) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.metabolism.slow");
|
||||
}
|
||||
if (metabolism >= 4) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.metabolism.slower");
|
||||
}
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.metabolism.slowest");
|
||||
}
|
||||
else {
|
||||
if (chromosome == EnumButterflyChromosome.FERTILITY) {
|
||||
final int metabolism = ((IAlleleInteger) allele).getValue();
|
||||
return metabolism + "x";
|
||||
}
|
||||
return super.getAlleleName(chromosome, allele);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDNAManipulable(final ItemStack member) {
|
||||
return ((IButterflyRoot) this.getSpeciesRoot()).getType(member) == EnumFlutterType.SERUM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getActiveTypes() {
|
||||
return new int[] { EnumFlutterType.BUTTERFLY.ordinal(), EnumFlutterType.CATERPILLAR.ordinal(), EnumFlutterType.SERUM.ordinal() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExtraAlleles(final IChromosomeType chromosome, final TreeSet<IAllele> alleles) {
|
||||
switch ((EnumButterflyChromosome) chromosome) {
|
||||
case FERTILITY: {
|
||||
for (final ForestryAllele.Int a : ForestryAllele.Int.values()) {
|
||||
alleles.add(a.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LIFESPAN: {
|
||||
for (final ForestryAllele.Lifespan a2 : ForestryAllele.Lifespan.values()) {
|
||||
alleles.add(a2.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case METABOLISM: {
|
||||
for (final ForestryAllele.Int a : ForestryAllele.Int.values()) {
|
||||
alleles.add(a.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TOLERANT_FLYER:
|
||||
case FIRE_RESIST:
|
||||
case NOCTURNAL: {
|
||||
for (final ForestryAllele.Bool a3 : ForestryAllele.Bool.values()) {
|
||||
alleles.add(a3.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SIZE: {
|
||||
for (final ForestryAllele.Size a4 : ForestryAllele.Size.values()) {
|
||||
alleles.add(a4.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPEED: {
|
||||
for (final ForestryAllele.Speed a5 : ForestryAllele.Speed.values()) {
|
||||
alleles.add(a5.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HUMIDITY_TOLERANCE:
|
||||
case TEMPERATURE_TOLERANCE: {
|
||||
for (final Tolerance a6 : Tolerance.values()) {
|
||||
alleles.add(a6.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
|
||||
public enum Tolerance
|
||||
{
|
||||
None(0, 0),
|
||||
Both1(-1, 1),
|
||||
Both2(-2, 2),
|
||||
Both3(-3, 3),
|
||||
Both4(-4, 4),
|
||||
Both5(-5, 5),
|
||||
Up1(0, 1),
|
||||
Up2(0, 2),
|
||||
Up3(0, 3),
|
||||
Up4(0, 4),
|
||||
Up5(0, 5),
|
||||
Down1(-1, 0),
|
||||
Down2(-2, 0),
|
||||
Down3(-3, 0),
|
||||
Down4(-4, 0),
|
||||
Down5(-5, 0);
|
||||
|
||||
private int[] bounds;
|
||||
|
||||
private Tolerance(final int a, final int b) {
|
||||
this.bounds = new int[] { a, b };
|
||||
}
|
||||
|
||||
public String getUID() {
|
||||
return "forestry.tolerance" + this.toString();
|
||||
}
|
||||
|
||||
public int[] getBounds() {
|
||||
return this.bounds;
|
||||
}
|
||||
|
||||
public static Tolerance get(final EnumTolerance tol) {
|
||||
return values()[tol.ordinal()];
|
||||
}
|
||||
|
||||
public IAllele getAllele() {
|
||||
return AlleleManager.alleleRegistry.getAllele(this.getUID());
|
||||
}
|
||||
|
||||
public <T extends Enum<T>> boolean canTolerate(final T base, final T test) {
|
||||
return test.ordinal() <= base.ordinal() + this.bounds[1] && test.ordinal() >= base.ordinal() + this.bounds[0];
|
||||
}
|
||||
|
||||
public static <T extends Enum<T>> boolean canTolerate(final T base, final T test, final EnumTolerance tol) {
|
||||
return get(tol).canTolerate(base, test);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,335 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import java.util.TreeSet;
|
||||
import java.util.Map;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.ITreeRoot;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import binnie.extratrees.machines.Lumbermill;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.arboriculture.IFruitProvider;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleFruit;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import forestry.api.genetics.IAllelePlantType;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.arboriculture.IArboristTracker;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.arboriculture.ITreeMutation;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.api.genetics.IMutation;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.FakeWorld;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.util.UniqueItemStackSet;
|
||||
|
||||
public class TreeBreedingSystem extends BreedingSystem
|
||||
{
|
||||
public UniqueItemStackSet allFruits;
|
||||
public UniqueItemStackSet allWoods;
|
||||
private UniqueItemStackSet discoveredFruits;
|
||||
private UniqueItemStackSet discoveredWoods;
|
||||
public UniqueItemStackSet discoveredPlanks;
|
||||
|
||||
public TreeBreedingSystem() {
|
||||
this.allFruits = new UniqueItemStackSet();
|
||||
this.allWoods = new UniqueItemStackSet();
|
||||
this.discoveredFruits = new UniqueItemStackSet();
|
||||
this.discoveredWoods = new UniqueItemStackSet();
|
||||
this.discoveredPlanks = new UniqueItemStackSet();
|
||||
this.iconUndiscovered = Binnie.Resource.getItemIcon(ExtraTrees.instance, "icon/undiscoveredTree");
|
||||
this.iconDiscovered = Binnie.Resource.getItemIcon(ExtraTrees.instance, "icon/discoveredTree");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(final IMutation mutation, final EntityPlayer player, final IAllele species1, final IAllele species2) {
|
||||
final ITreeGenome genome0 = (ITreeGenome) this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(species1.getUID()));
|
||||
final ITreeGenome genome2 = (ITreeGenome) this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(species2.getUID()));
|
||||
return ((ITreeMutation) mutation).getChance(player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ, (IAlleleTreeSpecies) species1, (IAlleleTreeSpecies) species2, genome0, genome2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return Binnie.Genetics.getTreeRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return 53006;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IBreedingTracker> getTrackerClass() {
|
||||
return IArboristTracker.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (chromosome == EnumTreeChromosome.GIRTH) {
|
||||
return ((IAlleleInteger) allele).getValue() + "x" + ((IAlleleInteger) allele).getValue();
|
||||
}
|
||||
if (chromosome == EnumTreeChromosome.PLANT) {
|
||||
final EnumSet<EnumPlantType> types = ((IAllelePlantType) allele).getPlantTypes();
|
||||
return types.isEmpty() ? Binnie.Language.localise(BinnieCore.instance, "allele.none") : types.iterator().next().toString();
|
||||
}
|
||||
if (chromosome == EnumTreeChromosome.FRUITS && allele.getUID().contains(".")) {
|
||||
final IFruitProvider provider = ((IAlleleFruit) allele).getProvider();
|
||||
return (provider.getProducts().length == 0) ? Binnie.Language.localise(BinnieCore.instance, "allele.none") : provider.getProducts()[0].getDisplayName();
|
||||
}
|
||||
if (chromosome == EnumTreeChromosome.GROWTH) {
|
||||
if (allele.getUID().contains("Tropical")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.growth.tropical");
|
||||
}
|
||||
if (allele.getUID().contains("Lightlevel")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.growth.lightlevel");
|
||||
}
|
||||
}
|
||||
return super.getAlleleName(chromosome, allele);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSyncBreedingTracker(final IBreedingTracker tracker) {
|
||||
this.discoveredFruits.clear();
|
||||
this.discoveredWoods.clear();
|
||||
for (final IAlleleSpecies species : this.getDiscoveredSpecies(tracker)) {
|
||||
final IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies) species;
|
||||
final ITreeGenome genome = (ITreeGenome) this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(tSpecies.getUID()));
|
||||
|
||||
FakeWorld world = FakeWorld.instance;
|
||||
genome.getPrimary().getGenerator().setLogBlock(genome, world, 0, 0, 0, ForgeDirection.UP);
|
||||
final ItemStack wood = world.getWooLog();
|
||||
if (wood != null) {
|
||||
this.discoveredWoods.add(wood);
|
||||
}
|
||||
|
||||
// for (final ItemStack wood :
|
||||
// tSpecies.getRoot().templateAsIndividual(getSpeciesRoot().getTemplate(tSpecies.getUID())).getProduceList())
|
||||
// {
|
||||
// this.discoveredWoods.add(wood);
|
||||
// }
|
||||
for (final ItemStack fruit : genome.getFruitProvider().getProducts()) {
|
||||
this.discoveredFruits.add(fruit);
|
||||
}
|
||||
for (ItemStack wood2 : this.discoveredWoods) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void calculateArrays() {
|
||||
super.calculateArrays();
|
||||
for (final IAlleleSpecies species : this.allActiveSpecies) {
|
||||
final IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies) species;
|
||||
final ITreeGenome genome = (ITreeGenome) this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(tSpecies.getUID()));
|
||||
|
||||
FakeWorld world = FakeWorld.instance;
|
||||
genome.getPrimary().getGenerator().setLogBlock(genome, world, 0, 0, 0, ForgeDirection.UP);
|
||||
final ItemStack wood = world.getWooLog();
|
||||
if (wood != null) {
|
||||
this.allWoods.add(wood);
|
||||
}
|
||||
|
||||
// for (final ItemStack wood :
|
||||
// tSpecies.getRoot().templateAsIndividual(getSpeciesRoot().getTemplate(tSpecies.getUID())).getProduceList())
|
||||
// {
|
||||
// this.allWoods.add(wood);
|
||||
// }
|
||||
for (final ItemStack fruit : genome.getFruitProvider().getProducts()) {
|
||||
this.allFruits.add(fruit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<IAlleleSpecies> getTreesThatBearFruit(final ItemStack fruit, final boolean nei, final World world, final GameProfile player) {
|
||||
final Collection<IAlleleSpecies> set = nei ? this.getAllSpecies() : this.getDiscoveredSpecies(world, player);
|
||||
final List<IAlleleSpecies> found = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAlleleSpecies species : set) {
|
||||
final IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies) species;
|
||||
final ITreeGenome genome = (ITreeGenome) this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(tSpecies.getUID()));
|
||||
for (final ItemStack fruit2 : genome.getFruitProvider().getProducts()) {
|
||||
if (fruit2.isItemEqual(fruit)) {
|
||||
found.add(species);
|
||||
}
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
public Collection<IAlleleSpecies> getTreesThatCanBearFruit(final ItemStack fruit, final boolean nei, final World world, final GameProfile player) {
|
||||
final Collection<IAlleleSpecies> set = nei ? this.getAllSpecies() : this.getDiscoveredSpecies(world, player);
|
||||
final List<IAlleleSpecies> found = new ArrayList<IAlleleSpecies>();
|
||||
final Set<IFruitFamily> providers = new HashSet<IFruitFamily>();
|
||||
for (final IAlleleSpecies species : set) {
|
||||
final IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies) species;
|
||||
final ITreeGenome genome = (ITreeGenome) this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(tSpecies.getUID()));
|
||||
for (final ItemStack fruit2 : genome.getFruitProvider().getProducts()) {
|
||||
if (fruit2.isItemEqual(fruit)) {
|
||||
providers.add(genome.getFruitProvider().getFamily());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (final IAlleleSpecies species : set) {
|
||||
final IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies) species;
|
||||
for (final IFruitFamily family : providers) {
|
||||
if (tSpecies.getSuitableFruit().contains(family)) {
|
||||
found.add(species);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
public Collection<IAlleleSpecies> getTreesThatHaveWood(final ItemStack fruit, final boolean nei, final World world, final GameProfile player) {
|
||||
final Collection<IAlleleSpecies> set = nei ? this.getAllSpecies() : this.getDiscoveredSpecies(world, player);
|
||||
final List<IAlleleSpecies> found = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAlleleSpecies species : set) {
|
||||
IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies) species;
|
||||
ITreeGenome genome = TreeManager.treeRoot.templateAsGenome(TreeManager.treeRoot.getTemplate(tSpecies.getUID()));
|
||||
// for (final ItemStack fruit2 :
|
||||
// tSpecies.getRoot().getMember(fruit).getProduceList()){
|
||||
tSpecies.getGenerator().setLogBlock(genome, FakeWorld.instance, 0, 0, 0, ForgeDirection.UP);
|
||||
ItemStack fruit2 = FakeWorld.instance.getWooLog();
|
||||
if (fruit2.isItemEqual(fruit)) {
|
||||
found.add(species);
|
||||
// }
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
public Collection<IAlleleSpecies> getTreesThatMakePlanks(final ItemStack fruit, final boolean nei, final World world, final GameProfile player) {
|
||||
if (fruit == null) {
|
||||
return new ArrayList<IAlleleSpecies>();
|
||||
}
|
||||
final Collection<IAlleleSpecies> set = nei ? this.getAllSpecies() : this.getDiscoveredSpecies(world, player);
|
||||
final List<IAlleleSpecies> found = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAlleleSpecies species : set) {
|
||||
final IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies) species;
|
||||
ITreeGenome genome = TreeManager.treeRoot.templateAsGenome(TreeManager.treeRoot.getTemplate(tSpecies.getUID()));
|
||||
tSpecies.getGenerator().setLogBlock(genome, FakeWorld.instance, 0, 0, 0, ForgeDirection.UP);
|
||||
ItemStack fruit2 = FakeWorld.instance.getWooLog();
|
||||
// for (final ItemStack fruit2 :
|
||||
// tSpecies.getRoot().getMember(fruit).getProduceList()) {
|
||||
if (Lumbermill.getPlankProduct(fruit2) != null && fruit.isItemEqual(Lumbermill.getPlankProduct(fruit2))) {
|
||||
found.add(species);
|
||||
}
|
||||
// }
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDNAManipulable(final ItemStack member) {
|
||||
return ((ITreeRoot) this.getSpeciesRoot()).getType(member) == EnumGermlingType.POLLEN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getConversion(final ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
for (final Map.Entry<ItemStack, IIndividual> entry : AlleleManager.ersatzSaplings.entrySet()) {
|
||||
if (ItemStack.areItemStacksEqual(stack, entry.getKey())) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getActiveTypes() {
|
||||
return new int[] { EnumGermlingType.SAPLING.ordinal(), EnumGermlingType.POLLEN.ordinal() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExtraAlleles(final IChromosomeType chromosome, final TreeSet<IAllele> alleles) {
|
||||
switch ((EnumTreeChromosome) chromosome) {
|
||||
case FERTILITY: {
|
||||
for (final ForestryAllele.Saplings a : ForestryAllele.Saplings.values()) {
|
||||
alleles.add(a.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GIRTH: {
|
||||
for (final ForestryAllele.Int a2 : ForestryAllele.Int.values()) {
|
||||
alleles.add(a2.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HEIGHT: {
|
||||
for (final ForestryAllele.TreeHeight a3 : ForestryAllele.TreeHeight.values()) {
|
||||
alleles.add(a3.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MATURATION: {
|
||||
for (final ForestryAllele.Maturation a4 : ForestryAllele.Maturation.values()) {
|
||||
alleles.add(a4.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SAPPINESS: {
|
||||
for (final ForestryAllele.Sappiness a5 : ForestryAllele.Sappiness.values()) {
|
||||
alleles.add(a5.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TERRITORY: {
|
||||
for (final ForestryAllele.Territory a6 : ForestryAllele.Territory.values()) {
|
||||
alleles.add(a6.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case YIELD: {
|
||||
for (final ForestryAllele.Yield a7 : ForestryAllele.Yield.values()) {
|
||||
alleles.add(a7.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FIREPROOF: {
|
||||
for (final ForestryAllele.Bool a8 : ForestryAllele.Bool.values()) {
|
||||
alleles.add(a8.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.apiculture.InventoryBeeHousing;
|
||||
import forestry.core.access.FakeAccessHandler;
|
||||
|
||||
public class VirtualBeeHousing extends VirtualHousing implements IBeeHousing, IBeeModifier
|
||||
{
|
||||
ArrayList<IBeeModifier> beeModifier = new ArrayList<IBeeModifier>();
|
||||
private InventoryBeeHousing beeInventory;
|
||||
|
||||
public VirtualBeeHousing(final EntityPlayer player) {
|
||||
super(player);
|
||||
beeModifier.add(this);
|
||||
beeInventory = new InventoryBeeHousing(12, FakeAccessHandler.getInstance());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public ItemStack getQueen() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack getDrone() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setQueen(final ItemStack itemstack) {
|
||||
}
|
||||
|
||||
public void setDrone(final ItemStack itemstack) {
|
||||
}
|
||||
|
||||
public boolean canBreed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addProduct(final ItemStack product, final boolean all) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void wearOutEquipment(final int amount) {
|
||||
}
|
||||
|
||||
public void onQueenChange(final ItemStack queen) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish() {
|
||||
return this.getBiomeId() == BiomeGenBase.hell.biomeID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public void onQueenDeath(final IBee queen) {
|
||||
}
|
||||
|
||||
public void onPostQueenDeath(final IBee queen) {
|
||||
}
|
||||
|
||||
public boolean onPollenRetrieved(final IBee queen, final IIndividual pollen, final boolean isHandled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onEggLaid(final IBee queen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(final IBeeGenome genome, final float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IErrorLogic getErrorLogic() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO ??
|
||||
@Override
|
||||
public boolean canBlockSeeTheSky() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO ??
|
||||
@Override
|
||||
public Vec3 getBeeFXCoordinates() {
|
||||
return Vec3.createVectorHelper(0, -100000, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return beeInventory;
|
||||
}
|
||||
|
||||
// TODO ??
|
||||
@Override
|
||||
public Iterable<IBeeListener> getBeeListeners() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<IBeeModifier> getBeeModifiers() {
|
||||
return beeModifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeekeepingLogic getBeekeepingLogic() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLightValue() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameProfile getOwner() {
|
||||
return getOwnerName();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.core.IErrorState;
|
||||
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.api.genetics.IHousing;
|
||||
|
||||
class VirtualHousing implements IHousing
|
||||
{
|
||||
private EntityPlayer player;
|
||||
|
||||
public VirtualHousing(final EntityPlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public int getXCoord() {
|
||||
return (int) this.player.posX;
|
||||
}
|
||||
|
||||
public int getYCoord() {
|
||||
return (int) this.player.posY;
|
||||
}
|
||||
|
||||
public int getZCoord() {
|
||||
return (int) this.player.posZ;
|
||||
}
|
||||
|
||||
public int getBiomeId() {
|
||||
return this.player.worldObj.getBiomeGenForCoords(this.getXCoord(), this.getYCoord()).biomeID;
|
||||
}
|
||||
|
||||
public EnumTemperature getTemperature() {
|
||||
return EnumTemperature.getFromValue(this.getBiome().temperature);
|
||||
}
|
||||
|
||||
public EnumHumidity getHumidity() {
|
||||
return EnumHumidity.getFromValue(this.getBiome().rainfall);
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return this.player.worldObj;
|
||||
}
|
||||
|
||||
public void setErrorState(final int state) {
|
||||
}
|
||||
|
||||
public int getErrorOrdinal() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean addProduct(final ItemStack product, final boolean all) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public GameProfile getOwnerName() {
|
||||
return this.player.getGameProfile();
|
||||
}
|
||||
|
||||
public BiomeGenBase getBiome() {
|
||||
return this.player.worldObj.getBiomeGenForCoords(this.getXCoord(), this.getZCoord());
|
||||
}
|
||||
|
||||
// public EnumErrorCode getErrorState() {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public void setErrorState(final IErrorState state) {
|
||||
}
|
||||
|
||||
public boolean setErrorCondition(final boolean condition, final IErrorState errorState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Set<IErrorState> getErrorStates() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates getCoordinates() {
|
||||
return new ChunkCoordinates(getXCoord(), getYCoord(), getZCoord());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import forestry.api.lepidopterology.IButterflyNursery;
|
||||
|
||||
public class VirtualMothHousing extends VirtualHousing implements IButterflyNursery
|
||||
{
|
||||
public VirtualMothHousing(final EntityPlayer player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IButterfly getCaterpillar() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getNanny() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCaterpillar(final IButterfly butterfly) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canNurse(final IButterfly butterfly) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user