Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package darkevilmac.MotherOfPearl.events;
- import java.util.ArrayList;
- import java.util.Random;
- import net.minecraft.block.Block;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraftforge.event.ForgeSubscribe;
- import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
- import tcc.MotherOfPearl.items.ModItems;
- import darkevilmac.MotherOfPearl.utils.Utilities;
- public class ClayBreakHandler {
- public static Random random = new Random();
- public static final ItemStack clayItemRandom = new ItemStack(Item.clay, Utilities.getRandom(1, 3), 0);
- public static final ItemStack oysterRandom = new ItemStack(ModItems.oyster, Utilities.getRandom(1, 2), 0);
- public static final ItemStack oysterRandomFortune = new ItemStack(ModItems.oyster, Utilities.getRandom(1, 4), 0);
- @ForgeSubscribe
- public void onBlockBreak(HarvestDropsEvent oEvent) {
- if (!oEvent.world.isRemote) {
- if (oEvent.block.blockID == Block.blockClay.blockID){
- //System.out.println("[MOP] Clay Broken");
- // if (event.block instanceof BlockClay) {
- //event.drops.clear();
- //System.out.println("[MOP] Clearing Drops");
- //int cDrop = Utilities.getRandom(1, 4);
- //int oDrop = 4 - cDrop;
- //int foDrop = Utilities.getRandom(0, oEvent.fortuneLevel);
- GenerateLootList(oEvent.drops,
- Item.clay.itemID,
- ModItems.oyster.itemID,
- ModItems.oyster.itemID,
- oEvent.fortuneLevel);
- oEvent.dropChance = 1.0F;
- //System.out.println("[MOP] 100% Chance to drop new items");
- //if (oEvent.fortuneLevel > 0) {
- //System.out.println("[MOP] Fortune Determined");
- // event.drops.add(oysterRandomFortune);
- //System.out.println("[MOP] Randomizing Fortune Oyster Drops");
- //}
- //event.drops.add(oysterRandom);
- //System.out.println("[MOP] Randomizing Oyster Drops");
- //event.drops.add(clayItemRandom);
- //System.out.println("[MOP] Randomizing ItemClay Drops");
- return;
- }
- }
- }
- private void GenerateLootList(ArrayList<ItemStack> oList, int cItemID, int oItemID, int foItemID, int flevel)
- {
- int cCount = Utilities.getRandom(1, 4);
- int oCount = 4 - cCount;
- int foCount = Utilities.getRandom(0, flevel);
- oList.clear();
- for(int i = 0; i < cCount; ++i)
- {
- ItemStack cdrop = new ItemStack(cItemID, 1, 0);
- oList.add(cdrop);
- }
- for(int i = 0; i < oCount; ++i)
- {
- ItemStack odrop = new ItemStack(oItemID, 1, 0);
- oList.add(odrop);
- }
- for(int i = 0; i < foCount; ++i)
- {
- ItemStack fodrop = new ItemStack(foItemID, 1, 0);
- oList.add(fodrop);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment