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.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(); |
| 17 | + | |
| 18 | - | public static final ItemStack clayItemRandom = new ItemStack(Item.clay, Utilities.getRandom(1, 3), 0); |
| 18 | + | |
| 19 | - | public static final ItemStack oysterRandom = new ItemStack(ModItems.oyster, Utilities.getRandom(1, 2), 0); |
| 19 | + | |
| 20 | - | public static final ItemStack oysterRandomFortune = new ItemStack(ModItems.oyster, Utilities.getRandom(1, 4), 0); |
| 20 | + | |
| 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 | - | oEvent.fortuneLevel); |
| 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 | - | private void GenerateLootList(ArrayList<ItemStack> oList, int cItemID, int oItemID, int foItemID, int flevel) |
| 37 | + | int foCount = 0; |
| 38 | if(flevel > 0) | |
| 39 | - | int cCount = MathHelper.getRandomIntegerInRange(random, 1, 4); |
| 39 | + | foCount = world.rand.nextInt(flevel); |
| 40 | oList.clear(); | |
| 41 | - | int foCount = MathHelper.getRandomIntegerInRange(random, 0, flevel); |
| 41 | + | |
| 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 | } |