use of forestry.api.genetics.ISpeciesType in project ForestryMC by ForestryMC.
the class TileGeneticFilter method getValidDirections.
public Collection<EnumFacing> getValidDirections(ItemStack itemStack, EnumFacing from) {
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(itemStack);
IIndividual individual = null;
ISpeciesType type = null;
if (root != null) {
individual = root.getMember(itemStack);
type = root.getType(itemStack);
}
IFilterData filterData = new FilterData(root, individual, type);
List<EnumFacing> validFacings = new LinkedList<>();
for (EnumFacing facing : EnumFacing.VALUES) {
if (facing == from) {
continue;
}
if (isValidFacing(facing, itemStack, filterData)) {
validFacings.add(facing);
}
}
return validFacings;
}
use of forestry.api.genetics.ISpeciesType in project ForestryMC by ForestryMC.
the class FilterLogic method isValid.
@Override
public boolean isValid(ItemStack itemStack, EnumFacing facing) {
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(itemStack);
IIndividual individual = null;
ISpeciesType type = null;
if (root != null) {
individual = root.getMember(itemStack);
type = root.getType(itemStack);
}
return isValid(facing, itemStack, new FilterData(root, individual, type));
}
use of forestry.api.genetics.ISpeciesType in project Binnie by ForestryMC.
the class WindowGenesis method refreshPickup.
private void refreshPickup() {
this.panelPickup.deleteAllChildren();
int i = 0;
IBreedingSystem system = Binnie.GENETICS.getSystem(this.root);
for (ISpeciesType type : system.getActiveTypes()) {
IIndividual ind = this.root.templateAsIndividual(this.template);
ind.analyze();
ItemStack stack = this.root.getMemberStack(ind, type);
ControlItemDisplay display = new ControlItemDisplay(this.panelPickup, 4 + i % 3 * 18, 4 + i / 3 * 18);
display.setItemStack(stack);
display.setTooltip();
display.addEventHandler(EventMouse.Down.class, EventHandlerOrigin.SELF, display, event -> {
NBTTagCompound nbt = new NBTTagCompound();
stack.writeToNBT(nbt);
Window.get(event.getOrigin()).sendClientAction(ACTION_GENESIS, nbt);
});
++i;
}
}
use of forestry.api.genetics.ISpeciesType in project Binnie by ForestryMC.
the class GenepoolRecipeMaker method create.
public static List<GenepoolRecipeWrapper> create() {
List<GenepoolRecipeWrapper> recipes = new ArrayList<>();
Collection<ISpeciesRoot> roots = AlleleManager.alleleRegistry.getSpeciesRoot().values();
for (ISpeciesRoot root : roots) {
ISpeciesType[] speciesTypes = root.getIconType().getClass().getEnumConstants();
IAllele[] defaultTemplate = root.getDefaultTemplate();
IIndividual individual = root.templateAsIndividual(defaultTemplate);
for (ISpeciesType speciesType : speciesTypes) {
ItemStack memberStack = root.getMemberStack(individual, speciesType);
memberStack.setItemDamage(OreDictionary.WILDCARD_VALUE);
GenepoolRecipeWrapper recipeWrapper = new GenepoolRecipeWrapper(memberStack);
recipes.add(recipeWrapper);
}
}
return recipes;
}
use of forestry.api.genetics.ISpeciesType in project Binnie by ForestryMC.
the class BreedingSystem method getConversionStack.
@Override
public ItemStack getConversionStack(final ItemStack stack) {
IIndividual conversion = this.getConversion(stack);
if (conversion == null) {
return ItemStack.EMPTY;
}
ISpeciesType type = this.getSpeciesRoot().getType(stack);
if (type == null) {
type = this.getDefaultType();
}
return this.getSpeciesRoot().getMemberStack(conversion, type);
}
Aggregations