SHOW:
|
|
- or go back to the newest paste.
| 1 | package darkevilmac.MotherOfPearl.events; | |
| 2 | ||
| 3 | import java.util.ArrayList; | |
| 4 | import java.util.Random; | |
| 5 | ||
| 6 | - | import net.minecraft.block.Block; |
| 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 | public static Random random = new Random(); | |
| 18 | public static final ItemStack clayItemRandom = new ItemStack(Item.clay, Utilities.getRandom(1, 3), 0); | |
| 19 | public static final ItemStack oysterRandom = new ItemStack(ModItems.oyster, Utilities.getRandom(1, 2), 0); | |
| 20 | public static final ItemStack oysterRandomFortune = new ItemStack(ModItems.oyster, Utilities.getRandom(1, 4), 0); | |
| 21 | ||
| 22 | @ForgeSubscribe | |
| 23 | public void onBlockBreak(HarvestDropsEvent oEvent) {
| |
| 24 | ||
| 25 | - | if (oEvent.block.blockID == Block.blockClay.blockID){
|
| 25 | + | |
| 26 | - | |
| 26 | + | if (oEvent.block instanceof BlockClay) {
|
| 27 | - | //System.out.println("[MOP] Clay Broken");
|
| 27 | + | |
| 28 | - | // if (event.block instanceof BlockClay) {
|
| 28 | + | |
| 29 | - | //event.drops.clear(); |
| 29 | + | |
| 30 | - | //System.out.println("[MOP] Clearing Drops");
|
| 30 | + | |
| 31 | - | //int cDrop = Utilities.getRandom(1, 4); |
| 31 | + | |
| 32 | - | //int oDrop = 4 - cDrop; |
| 32 | + | |
| 33 | - | //int foDrop = Utilities.getRandom(0, oEvent.fortuneLevel); |
| 33 | + | |
| 34 | } | |
| 35 | } | |
| 36 | } | |
| 37 | private void GenerateLootList(ArrayList<ItemStack> oList, int cItemID, int oItemID, int foItemID, int flevel) | |
| 38 | {
| |
| 39 | - | |
| 39 | + | int cCount = MathHelper.getRandomIntegerInRange(random, 1, 4); |
| 40 | int oCount = 4 - cCount; | |
| 41 | - | |
| 41 | + | int foCount = MathHelper.getRandomIntegerInRange(random, 0, flevel); |
| 42 | - | //System.out.println("[MOP] 100% Chance to drop new items");
|
| 42 | + | |
| 43 | - | //if (oEvent.fortuneLevel > 0) {
|
| 43 | + | |
| 44 | - | |
| 44 | + | |
| 45 | - | //System.out.println("[MOP] Fortune Determined");
|
| 45 | + | |
| 46 | - | // event.drops.add(oysterRandomFortune); |
| 46 | + | |
| 47 | - | //System.out.println("[MOP] Randomizing Fortune Oyster Drops");
|
| 47 | + | |
| 48 | - | //} |
| 48 | + | |
| 49 | - | //event.drops.add(oysterRandom); |
| 49 | + | |
| 50 | - | //System.out.println("[MOP] Randomizing Oyster Drops");
|
| 50 | + | |
| 51 | - | //event.drops.add(clayItemRandom); |
| 51 | + | |
| 52 | - | //System.out.println("[MOP] Randomizing ItemClay Drops");
|
| 52 | + | |
| 53 | for(int i = 0; i < foCount; ++i) | |
| 54 | {
| |
| 55 | ItemStack fodrop = new ItemStack(foItemID, 1, 0); | |
| 56 | oList.add(fodrop); | |
| 57 | } | |
| 58 | ||
| 59 | } | |
| 60 | - | int cCount = Utilities.getRandom(1, 4); |
| 60 | + | |
| 61 | } |