use of forestry.api.apiculture.EnumBeeType in project Railcraft by Railcraft.
the class FilterBeesGenomeRecipe method getCraftingResult.
@Override
public ItemStack getCraftingResult(InventoryCrafting grid) {
if (!matches(grid, null))
return InvTools.emptyStack();
InventoryComposite inv = InventoryComposite.of(grid);
ItemStack filter = grid.getStackInRowAndColumn(1, 1);
ItemStack type = grid.getStackInRowAndColumn(1, 0);
ItemStack active = grid.getStackInRowAndColumn(0, 1);
ItemStack inactive = grid.getStackInRowAndColumn(2, 1);
if (InvTools.isEmpty(filter))
return InvTools.emptyStack();
try {
EnumBeeType beeType = BeeManager.beeRoot.getType(type);
String typeName = "";
if (beeType != null)
typeName = beeType.name();
return ItemFilterBeeGenome.setBeeFilter(filter, typeName, active, inactive);
} catch (Throwable error) {
Game.logErrorAPI(Mod.FORESTRY.modId, error, BeeManager.class);
return InvTools.emptyStack();
}
}
use of forestry.api.apiculture.EnumBeeType in project Railcraft by Railcraft.
the class ItemFilterBeeGenome method getBeeFilter.
@Nullable
public static BeeFilter getBeeFilter(ItemStack stack) {
NBTTagCompound nbt = InvTools.getItemDataRailcraft(stack, "filter");
if (nbt != null) {
try {
String typeName = nbt.getString("type");
EnumBeeType type = null;
try {
type = EnumBeeType.valueOf(typeName);
} catch (IllegalArgumentException ignored) {
}
EnumBeeChromosome chromosome = EnumBeeChromosome.SPECIES;
try {
chromosome = EnumBeeChromosome.valueOf(nbt.getString("chromosome"));
} catch (IllegalArgumentException ignored) {
}
ItemStack active = NBTPlugin.readItemStack(nbt, "active");
ItemStack inactive = NBTPlugin.readItemStack(nbt, "inactive");
return new BeeFilter(type, chromosome, active, inactive);
} catch (Throwable ignored) {
}
}
return new BeeFilter(null, EnumBeeChromosome.SPECIES, null, null);
}
Aggregations