Fix crashed caused by bad mods reflectively breaking the grass drop list. Closes #3943
This commit is contained in:
parent
c544f06880
commit
e67bde9e9e
|
@ -55,10 +55,8 @@ import net.minecraft.entity.projectile.EntityThrowable;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.inventory.ContainerRepair;
|
import net.minecraft.inventory.ContainerRepair;
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.ItemArmor;
|
|
||||||
import net.minecraft.item.ItemAxe;
|
import net.minecraft.item.ItemAxe;
|
||||||
import net.minecraft.item.ItemBucket;
|
import net.minecraft.item.ItemBucket;
|
||||||
import net.minecraft.item.ItemPickaxe;
|
import net.minecraft.item.ItemPickaxe;
|
||||||
|
@ -149,6 +147,10 @@ public class ForgeHooks
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static ItemStack getGrassSeed(Random rand, int fortune)
|
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);
|
SeedEntry entry = WeightedRandom.getRandomItem(rand, seedList);
|
||||||
if (entry == null || entry.seed.isEmpty())
|
if (entry == null || entry.seed.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -1269,8 +1271,8 @@ public class ForgeHooks
|
||||||
return (ev.getResult() == Event.Result.ALLOW || (ev.getResult() == Event.Result.DEFAULT && def));
|
return (ev.getResult() == Event.Result.ALLOW || (ev.getResult() == Event.Result.DEFAULT && def));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onCropsGrowPost(World worldIn, BlockPos pos, IBlockState state, IBlockState blockState)
|
public static void onCropsGrowPost(World worldIn, BlockPos pos, IBlockState state, IBlockState blockState)
|
||||||
{
|
{
|
||||||
MinecraftForge.EVENT_BUS.post(new BlockEvent.CropGrowEvent.Post(worldIn, pos, state, worldIn.getBlockState(pos)));
|
MinecraftForge.EVENT_BUS.post(new BlockEvent.CropGrowEvent.Post(worldIn, pos, state, worldIn.getBlockState(pos)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue