1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package me.km.blocks;
- import me.km.items.ModItems;
- import net.minecraft.block.SoundType;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.entity.Entity;
- import net.minecraft.item.ItemStack;
- import net.minecraft.util.NonNullList;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.world.IBlockAccess;
- import net.minecraft.world.World;
- public class BlockTallGrass extends net.minecraft.block.BlockTallGrass
- {
- private final SoundType type;
-
- public BlockTallGrass()
- {
- super.setHardness(0);
- type = SoundType.PLANT;
- }
- @Override
- public SoundType getSoundType(IBlockState state, World world, BlockPos pos, Entity entity)
- {
- return type;
- }
-
- @Override
- public NonNullList<ItemStack> getDrops(IBlockAccess w, BlockPos pos, IBlockState state, int fortune)
- {
- int rand = RANDOM.nextInt(8);
- if(rand <= 3)
- {
- return NonNullList.withSize(1, new ItemStack(ModItems.hayBundle));
- }
- else if(RANDOM.nextInt(8) == 4)
- {
- ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(RANDOM, fortune);
- if(!seed.isEmpty())
- {
- return NonNullList.withSize(1, seed);
- }
- }
- return NonNullList.create();
- }
- }
|