SHOW:
|
|
- or go back to the newest paste.
| 1 | package darkevilmac.MotherOfPearl.events; | |
| 2 | ||
| 3 | import java.util.ArrayList; | |
| 4 | - | import java.util.Random; |
| 4 | + | |
| 5 | import net.minecraft.block.BlockClay; | |
| 6 | import net.minecraft.item.Item; | |
| 7 | import net.minecraft.item.ItemStack; | |
| 8 | import net.minecraft.world.World; | |
| 9 | - | import net.minecraft.util.MathHelper; |
| 9 | + | |
| 10 | import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent; | |
| 11 | import tcc.MotherOfPearl.items.ModItems; | |
| 12 | ||
| 13 | - | import darkevilmac.MotherOfPearl.utils.Utilities; |
| 13 | + | |
| 14 | ||
| 15 | @ForgeSubscribe | |
| 16 | public void onBlockBreak(HarvestDropsEvent oEvent) {
| |
| 17 | ||
| 18 | if (!oEvent.world.isRemote) {
| |
| 19 | if (oEvent.block instanceof BlockClay) {
| |
| 20 | GenerateLootList(oEvent.drops, | |
| 21 | Item.clay.itemID, | |
| 22 | ModItems.oyster.itemID, | |
| 23 | ModItems.oyster.itemID, | |
| 24 | oEvent.fortuneLevel, | |
| 25 | oEvent.world); | |
| 26 | oEvent.dropChance = 1.0F; | |
| 27 | - | oEvent.world); |
| 27 | + | |
| 28 | } | |
| 29 | } | |
| 30 | } | |
| 31 | private void GenerateLootList(ArrayList<ItemStack> oList, int cItemID, int oItemID, int foItemID, int flevel, World world) | |
| 32 | {
| |
| 33 | int oChance = world.rand.nextInt(4); | |
| 34 | int cCount = world.rand.nextInt(3)+1; | |
| 35 | int oCount = 4 - cCount; | |
| 36 | int foCount = 0; | |
| 37 | - | int foCount = 0; |
| 37 | + | if(flevel > 0) |
| 38 | - | if(flevel > 0) |
| 38 | + | foCount = world.rand.nextInt(flevel); |
| 39 | - | foCount = world.rand.nextInt(flevel); |
| 39 | + | |
| 40 | if(oChance == 0){
| |
| 41 | - | for(int i = 0; i < cCount; ++i) |
| 41 | + | for(int i = 0; i < cCount; ++i) |
| 42 | {
| |
| 43 | - | ItemStack cdrop = new ItemStack(cItemID, 1, 0); |
| 43 | + | ItemStack cdrop = new ItemStack(cItemID, 1, 0); |
| 44 | - | oList.add(cdrop); |
| 44 | + | oList.add(cdrop); |
| 45 | } | |
| 46 | - | for(int i = 0; i < oCount; ++i) |
| 46 | + | |
| 47 | if(oChance == 0){
| |
| 48 | - | ItemStack odrop = new ItemStack(oItemID, 1, 0); |
| 48 | + | for(int i = 0; i < oCount; ++i) |
| 49 | - | oList.add(odrop); |
| 49 | + | {
|
| 50 | ItemStack odrop = new ItemStack(oItemID, 1, 0); | |
| 51 | oList.add(odrop); | |
| 52 | } | |
| 53 | } | |
| 54 | if(oChance > 0){
| |
| 55 | for(int i = 0; i < 4; ++i) | |
| 56 | {
| |
| 57 | ItemStack cdrop = new ItemStack(cItemID, 1, 0); | |
| 58 | oList.add(cdrop); | |
| 59 | } | |
| 60 | } | |
| 61 | for(int i = 0; i < foCount; ++i) | |
| 62 | {
| |
| 63 | ItemStack fodrop = new ItemStack(foItemID, 1, 0); | |
| 64 | oList.add(fodrop); | |
| 65 | } | |
| 66 | ||
| 67 | } | |
| 68 | ||
| 69 | } |