DemoXin

Untitled

Nov 21st, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package darkevilmac.MotherOfPearl.events;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Random;
  5.  
  6. import net.minecraft.block.BlockClay;
  7. import net.minecraft.item.Item;
  8. import net.minecraft.item.ItemStack;
  9. import net.minecraft.util.MathHelper;
  10. import net.minecraftforge.event.ForgeSubscribe;
  11. import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
  12. import tcc.MotherOfPearl.items.ModItems;
  13. import darkevilmac.MotherOfPearl.utils.Utilities;
  14.  
  15. public class ClayBreakHandler {
  16.  
  17.     @ForgeSubscribe
  18.     public void onBlockBreak(HarvestDropsEvent oEvent) {
  19.    
  20.         if (!oEvent.world.isRemote) {
  21.             if (oEvent.block instanceof BlockClay) {
  22.                 GenerateLootList(oEvent.drops,
  23.                         Item.clay.itemID,
  24.                         ModItems.oyster.itemID,
  25.                         ModItems.oyster.itemID,
  26.                         oEvent.fortuneLevel,
  27.             oEvent.world);
  28.                 oEvent.dropChance = 1.0F;
  29.                 return;
  30.             }
  31.         }
  32.     }
  33.     private void GenerateLootList(ArrayList<ItemStack> oList, int cItemID, int oItemID, int foItemID, int flevel, World world)
  34.     {
  35.         int cCount = world.rand.nextInt(3)+1;
  36.         int oCount = 4 - cCount;
  37.     int foCount = 0;
  38.     if(flevel > 0)
  39.             foCount = world.rand.nextInt(flevel);
  40.         oList.clear();
  41.         for(int i = 0; i < cCount; ++i)
  42.         {
  43.             ItemStack cdrop = new ItemStack(cItemID, 1, 0);
  44.             oList.add(cdrop);
  45.         }
  46.         for(int i = 0; i < oCount; ++i)
  47.         {
  48.             ItemStack odrop = new ItemStack(oItemID, 1, 0);
  49.             oList.add(odrop);
  50.         }
  51.         for(int i = 0; i < foCount; ++i)
  52.         {
  53.             ItemStack fodrop = new ItemStack(foItemID, 1, 0);
  54.             oList.add(fodrop);
  55.         }
  56.        
  57.     }
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment