Fix #1563 Crash when viewing bee trades with a villager

This commit is contained in:
mezz committed 2017-01-08 03:20:40 -08:00
1 parent 17e38e7c5e
commit bb0a0343c1
3 files changed
+8 -1

No files matched your search

@@ -23,6 +23,7 @@ import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleSpecies;
import forestry.apiculture.genetics.BeeGenome;
import forestry.apiculture.genetics.DefaultBeeModelProvider;
import forestry.core.config.Config;
import forestry.core.genetics.ItemGE;
import forestry.core.items.IColoredItem;
@@ -144,6 +145,9 @@ public class ItemBeeGE extends ItemGE implements IColoredItem {
private class BeeMeshDefinition implements ItemMeshDefinition {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
if (!stack.hasTagCompound()) { // villager trade wildcard bees
return DefaultBeeModelProvider.instance.getModel(type);
}
IAlleleBeeSpecies species = (IAlleleBeeSpecies) getSpecies(stack);
return species.getModel(type);
}
@@ -51,6 +51,9 @@ public abstract class ItemGE extends ItemForestry {
@Override
public boolean hasEffect(ItemStack stack) {
if (!stack.hasTagCompound()) { // villager trade wildcard bees
return false;
}
IAlleleSpecies species = getSpecies(stack);
return species.hasEffect();
}