BlockCampFireBurnt.java 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package me.km.blocks.campfire;
  2. import java.util.Random;
  3. import net.minecraft.block.state.IBlockState;
  4. import net.minecraft.entity.player.EntityPlayer;
  5. import net.minecraft.init.Items;
  6. import net.minecraft.item.Item;
  7. import net.minecraft.item.ItemStack;
  8. import net.minecraft.util.EnumFacing;
  9. import net.minecraft.util.EnumHand;
  10. import net.minecraft.util.NonNullList;
  11. import net.minecraft.util.math.BlockPos;
  12. import net.minecraft.world.IBlockAccess;
  13. import net.minecraft.world.World;
  14. public class BlockCampFireBurnt extends BlockCampFire
  15. {
  16. public BlockCampFireBurnt(String name, String local)
  17. {
  18. super(name, local);
  19. }
  20. @Override
  21. public boolean onBlockActivated(World w, BlockPos pos, IBlockState state, EntityPlayer p, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
  22. {
  23. return false;
  24. }
  25. @Override
  26. public Item getItemDropped(IBlockState state, Random rand, int fortune)
  27. {
  28. return Items.STICK;
  29. }
  30. @Override
  31. public int quantityDropped(Random r)
  32. {
  33. return r.nextInt(3) + 1;
  34. }
  35. @Override
  36. public void getDrops(NonNullList<ItemStack> drops, IBlockAccess w, BlockPos pos, IBlockState state, int fortune)
  37. {
  38. super.getDrops(drops, w, pos, state, 0);
  39. Random rand = w instanceof World ? ((World) w).rand : new Random();
  40. if(rand.nextBoolean())
  41. {
  42. drops.add(new ItemStack(Items.COAL, 1, 1));
  43. }
  44. }
  45. }