use of binnie.extratrees.genetics.ETTreeDefinition in project Binnie by ForestryMC.
the class BlockETDecorativeLeaves method colorMultiplier.
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
ETTreeDefinition treeDefinition = state.getValue(getVariant());
ITreeGenome genome = treeDefinition.getGenome();
if (tintIndex == 0) {
return genome.getPrimary().getLeafSpriteProvider().getColor(false);
} else {
IFruitProvider fruitProvider = genome.getFruitProvider();
return fruitProvider.getDecorativeColor();
}
}
use of binnie.extratrees.genetics.ETTreeDefinition in project Binnie by ForestryMC.
the class ModuleWood method onBakedEvent.
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onBakedEvent(ModelBakeEvent e) {
// Find all ExtraTrees saplings
List<ModelResourceLocation> models = e.getModelRegistry().getKeys().stream().filter(mrl -> mrl.getResourceDomain().startsWith(Constants.EXTRA_TREES_MOD_ID)).filter(mrl -> mrl.getResourcePath().startsWith("germlings")).collect(Collectors.toList());
// Replace model
Map<String, ETTreeDefinition> map = Arrays.stream(ETTreeDefinition.values()).collect(Collectors.toMap(o -> o.name().toLowerCase(), o -> o));
models.forEach(model -> {
String species = model.getVariant().split("=")[1];
ETTreeDefinition treeSpecies = map.get(species);
int primaryColor = treeSpecies.getLeafColor().getRGB();
int secondaryColor = treeSpecies.getWoodColor().getRGB();
IBakedModel bakedModel = e.getModelRegistry().getObject(model);
if (bakedModel == null) {
return;
}
e.getModelRegistry().putObject(model, new DoublePassBakedModel(bakedModel, primaryColor, secondaryColor));
});
}
use of binnie.extratrees.genetics.ETTreeDefinition in project Binnie by ForestryMC.
the class ItemBlockETDecorativeLeaves method getColorFromItemstack.
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemstack(ItemStack itemStack, int renderPass) {
int meta = itemStack.getMetadata();
BlockETDecorativeLeaves block = getBlock();
ETTreeDefinition treeDefinition = block.getTreeType(meta);
if (treeDefinition == null) {
return ModuleArboriculture.proxy.getFoliageColorBasic();
}
ITreeGenome genome = treeDefinition.getGenome();
if (renderPass == 0) {
return genome.getPrimary().getLeafSpriteProvider().getColor(false);
} else {
IFruitProvider fruitProvider = genome.getFruitProvider();
return fruitProvider.getDecorativeColor();
}
}
Aggregations