Skip to content

Commit

Permalink
Fix #556 Rendering ingredient exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Nedelosk committed Nov 8, 2018
1 parent cf0c37f commit 9dfc154
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions botany/src/main/java/binnie/botany/items/ItemFlowerGE.java
@@ -1,12 +1,8 @@
package binnie.botany.items;

import binnie.botany.api.BotanyAPI;
import com.google.common.base.Preconditions;

import javax.annotation.Nullable;
import java.util.List;

import forestry.api.genetics.IAlleleSpecies;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.state.IBlockState;
Expand Down Expand Up @@ -35,12 +31,14 @@

import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import forestry.core.config.Config;
import forestry.core.items.IColoredItem;

import binnie.botany.CreativeTabBotany;
import binnie.botany.api.BotanyAPI;
import binnie.botany.api.genetics.EnumFlowerChromosome;
import binnie.botany.api.genetics.EnumFlowerStage;
import binnie.botany.api.genetics.IAlleleFlowerSpecies;
Expand All @@ -50,6 +48,7 @@
import binnie.botany.blocks.BlockFlower;
import binnie.botany.core.BotanyCore;
import binnie.botany.genetics.Flower;
import binnie.botany.genetics.FlowerDefinition;
import binnie.botany.modules.ModuleFlowers;
import binnie.core.util.I18N;

Expand Down Expand Up @@ -270,7 +269,9 @@ private class BotanyMeshDefinition implements ItemMeshDefinition {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
IFlower flower = BotanyCore.getFlowerRoot().getMember(stack);
Preconditions.checkNotNull(flower);
if(flower == null){
flower = FlowerDefinition.Poppy.getIndividual();
}
IAlleleFlowerSpecies flowerSpecies = flower.getGenome().getPrimary();
return flowerSpecies.getFlowerModel(type, flower.hasFlowered());
}
Expand Down

0 comments on commit 9dfc154

Please sign in to comment.