use of forestry.api.arboriculture.IAlleleFruit in project ForestryMC by ForestryMC.
the class FruitPodStateMapper method putStateModelLocations.
@Override
public Map<IBlockState, ModelResourceLocation> putStateModelLocations(Block block) {
if (block instanceof BlockFruitPod) {
BlockFruitPod blockFruitPod = (BlockFruitPod) block;
IAlleleFruit fruit = blockFruitPod.getFruit();
String modID = fruit.getModID();
if (modID == null) {
modID = Constants.MOD_ID;
}
String modelName = fruit.getModelName();
String resourcePath = modID + ":pods/" + modelName;
for (IBlockState state : block.getBlockState().getValidStates()) {
String propertyString = getPropertyString(state.getProperties());
mapStateModelLocations.put(state, new ModelResourceLocation(resourcePath, propertyString));
}
}
return mapStateModelLocations;
}
use of forestry.api.arboriculture.IAlleleFruit in project ForestryMC by ForestryMC.
the class ModuleArboriculture method registerSprites.
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void registerSprites(TextureStitchEvent.Pre event) {
TextureLeaves.registerAllSprites();
WoodTextureManager.parseFile();
for (IAlleleFruit alleleFruit : AlleleFruits.getFruitAlleles()) {
alleleFruit.getProvider().registerSprites();
}
List<ResourceLocation> textures = new ArrayList<>();
for (IWoodType type : TreeManager.woodAccess.getRegisteredWoodTypes()) {
textures.add(new ResourceLocation(type.getHeartTexture()));
textures.add(new ResourceLocation(type.getBarkTexture()));
textures.add(new ResourceLocation(type.getDoorLowerTexture()));
textures.add(new ResourceLocation(type.getDoorUpperTexture()));
textures.add(new ResourceLocation(type.getPlankTexture()));
for (WoodBlockKind kind : WoodBlockKind.values()) {
for (Entry<String, String> loc : WoodTextureManager.getTextures(type, kind).entrySet()) {
textures.add(new ResourceLocation(loc.getValue()));
}
}
}
for (ResourceLocation loc : textures) {
TextureManagerForestry.registerSprite(loc);
}
}
use of forestry.api.arboriculture.IAlleleFruit in project ForestryMC by ForestryMC.
the class TreeAlyzerPlugin method drawAnalyticsPage2.
@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage2(GuiScreen gui, ItemStack itemStack) {
if (gui instanceof GuiAlyzer) {
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
ITree tree = TreeManager.treeRoot.getMember(itemStack);
if (tree == null) {
return;
}
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
int speciesDominance0 = guiAlyzer.getColorCoding(tree.getGenome().getPrimary().isDominant());
int speciesDominance1 = guiAlyzer.getColorCoding(tree.getGenome().getSecondary().isDominant());
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
textLayout.newLine();
textLayout.newLine();
String yes = Translator.translateToLocal("for.yes");
String no = Translator.translateToLocal("for.no");
String fireproofActive = StringUtil.readableBoolean(tree.getGenome().getFireproof(), yes, no);
String fireproofInactive = StringUtil.readableBoolean(((AlleleBoolean) tree.getGenome().getInactiveAllele(EnumTreeChromosome.FIREPROOF)).getValue(), yes, no);
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.fireproof"), fireproofActive, fireproofInactive, tree, EnumTreeChromosome.FIREPROOF);
textLayout.newLine();
textLayout.drawLine(Translator.translateToLocal("for.gui.native"), GuiAlyzer.COLUMN_0);
textLayout.drawLine(Translator.translateToLocal("for.gui." + tree.getGenome().getPrimary().getPlantType().toString().toLowerCase(Locale.ENGLISH)), GuiAlyzer.COLUMN_1, speciesDominance0);
textLayout.drawLine(Translator.translateToLocal("for.gui." + tree.getGenome().getSecondary().getPlantType().toString().toLowerCase(Locale.ENGLISH)), GuiAlyzer.COLUMN_2, speciesDominance1);
textLayout.newLine();
// FRUITS
textLayout.drawLine(Translator.translateToLocal("for.gui.supports"), GuiAlyzer.COLUMN_0);
List<IFruitFamily> families0 = new ArrayList<>(tree.getGenome().getPrimary().getSuitableFruit());
List<IFruitFamily> families1 = new ArrayList<>(tree.getGenome().getSecondary().getSuitableFruit());
int max = Math.max(families0.size(), families1.size());
for (int i = 0; i < max; i++) {
if (i > 0) {
textLayout.newLineCompressed();
}
if (families0.size() > i) {
textLayout.drawLine(families0.get(i).getName(), GuiAlyzer.COLUMN_1, speciesDominance0);
}
if (families1.size() > i) {
textLayout.drawLine(families1.get(i).getName(), GuiAlyzer.COLUMN_2, speciesDominance1);
}
}
textLayout.newLine();
int fruitDominance0 = guiAlyzer.getColorCoding(tree.getGenome().getActiveAllele(EnumTreeChromosome.FRUITS).isDominant());
int fruitDominance1 = guiAlyzer.getColorCoding(tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS).isDominant());
textLayout.drawLine(Translator.translateToLocal("for.gui.fruits"), GuiAlyzer.COLUMN_0);
String strike = "";
IAllele fruit0 = tree.getGenome().getActiveAllele(EnumTreeChromosome.FRUITS);
if (!tree.canBearFruit() && fruit0 != AlleleFruits.fruitNone) {
strike = TextFormatting.STRIKETHROUGH.toString();
}
textLayout.drawLine(strike + tree.getGenome().getFruitProvider().getDescription(), GuiAlyzer.COLUMN_1, fruitDominance0);
strike = "";
IAlleleFruit fruit1 = (IAlleleFruit) tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS);
if (!tree.getGenome().getSecondary().getSuitableFruit().contains(fruit1.getProvider().getFamily()) && fruit1 != AlleleFruits.fruitNone) {
strike = TextFormatting.STRIKETHROUGH.toString();
}
textLayout.drawLine(strike + fruit1.getProvider().getDescription(), GuiAlyzer.COLUMN_2, fruitDominance1);
textLayout.newLine();
textLayout.drawLine(Translator.translateToLocal("for.gui.family"), GuiAlyzer.COLUMN_0);
IFruitFamily primary = tree.getGenome().getFruitProvider().getFamily();
IFruitFamily secondary = ((IAlleleFruit) tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS)).getProvider().getFamily();
if (primary != null && !primary.getUID().equals(EnumFruitFamily.NONE.getUID())) {
textLayout.drawLine(primary.getName(), GuiAlyzer.COLUMN_1, fruitDominance0);
}
if (secondary != null && !secondary.getUID().equals(EnumFruitFamily.NONE.getUID())) {
textLayout.drawLine(secondary.getName(), GuiAlyzer.COLUMN_2, fruitDominance1);
}
textLayout.endPage();
}
}
use of forestry.api.arboriculture.IAlleleFruit in project ForestryMC by ForestryMC.
the class BlockFruitPod method create.
public static List<BlockFruitPod> create() {
List<BlockFruitPod> blocks = new ArrayList<>();
for (IAlleleFruit fruit : AlleleFruits.getFruitAllelesWithModels()) {
BlockFruitPod block = new BlockFruitPod(fruit);
blocks.add(block);
}
return blocks;
}
Aggregations