Fix crashed caused by bad mods reflectively breaking the grass drop list. Closes #3943

This commit is contained in:
LexManos 2017-06-02 16:22:16 -07:00
parent c544f06880
commit e67bde9e9e
1 changed files with 9 additions and 7 deletions

View File

@ -55,10 +55,8 @@ import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.ContainerRepair;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemBucket;
import net.minecraft.item.ItemPickaxe;
@ -149,6 +147,10 @@ public class ForgeHooks
@Nonnull
public static ItemStack getGrassSeed(Random rand, int fortune)
{
if (seedList.size() == 0)
{
return ItemStack.EMPTY; //Some bad mods hack in and empty our list, so lets not hard crash -.-
}
SeedEntry entry = WeightedRandom.getRandomItem(rand, seedList);
if (entry == null || entry.seed.isEmpty())
{