Jump to content

Recommended Posts

Posted

how would i make it so that this code returns on item form list l== and one item from list w==

    public int idDropped(int par1, Random par2Random, int par3)
    {
                    int w = par2Random.nextInt(100);
                    int l = par2Random.nextInt(100);
                    if (l < 25)
                    {
                            return ashtonsmod.IngotBush.blockID;
                    }
                    if (w <3)
                    {
                            return ashtonsmod.Amethyst.itemID;
                    }
                    if (w == 70 ||w == 71 ||w == 72 ||w == 73 ||w == 74 ||w == 75 ||w == 76 ||w == 77 ||w == 78 ||w == 79)
                    {
                            return ashtonsmod.LightSteelNugget.itemID;
                    }
                    if (w == 86 ||w == 87 ||w == 88 ||w == 89 ||w == 90)
                    {
                            return Item.ingotGold.itemID;
                    }
                    if (w == 80 || w == 81 || w == 82 || w == 83 || w == 84)
                    {
                            return Item.goldNugget.itemID;
                    }
                    if (w == 60 || w == 61 || w == 62|| w == 63|| w == 64|| w == 65|| w == 66|| w == 67|| w == 68|| w == 69|| w == 59)
                    {
                            return Item.ingotIron.itemID;
                    }
                    if (w == 90 || w == 91 || w == 92 || w == 93 || w == 94 || w == 95)
                    {
                            return Item.emerald.itemID;
                    }
                    if (w == 4 || w == 5|| w == 6|| w == 7|| w == 8|| w == 9|| w == 10)
                    {
                            return Block.obsidian.blockID;
                    }
                    if (w >96)
                    {
                            return Item.diamond.itemID;
                    }
                    if (w == 30 || w == 31|| w == 32|| w == 33|| w == 34|| w == 35|| w == 36|| w == 37|| w == 38|| w == 39|| w == 40|| w == 41|| w == 42|| w == 43|| w == 44|| w == 45|| w == 46|| w == 47|| w == 48|| w == 49)
                    {
                    	return Item.coal.itemID;
                    }
				return w;
    }

    public int quantityDroppedWithBonus(int par1, Random par2Random)
    {
            return quantityDropped(par2Random) + par2Random.nextInt(par1 + 1);
    }

    public int quantityDropped(Random par1Random)
    {
            return 1 + par1Random.nextInt(1); 
    }

Use examples, i have aspergers.

Examples make sense to me.

Posted

if you read my code i have two random numbers l and w both are chosen out of one hundred and depending on the outcome, when broken this block will drop what it is tole. how do i make it so that it will try to drop one from the random integer l and one from he random integer w

so possibly two drops.

Use examples, i have aspergers.

Examples make sense to me.

Posted

if you read my code i have two random numbers l and w both are chosen out of one hundred and depending on the outcome, when broken this block will drop what it is tole. how do i make it so that it will try to drop one from the random integer l and one from he random integer w

so possibly two drops.

 

I understood the code I just didn't understand you

 

and yet I still don't fully understand what you want

 

do you

a) want to drop one item from l and w

b) drop more than one item from l OR drop more than one item from w

Posted

I'm not an expert, and I don't quite understand your problem, and maybe this is not the solution. But maybe you could override Block.dropBlockAsItemWithChance and possibly Block.getBlockDropped and put your logic in those 2 methods?

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

Posted

due to the ambiguousness of your question I am just going to give what I think you need/want

 

Note: I am coding this on my phone so just paste it in and ctrl + shift + f if your using eclipse to format it

public ArrayList getBlockDropped(World w, int x, int y, int z, int meta, int fortune) { ArrayList list = new ArrayList();int w = par2Random.nextInt(100);int l = par2Random.nextInt(100); if (l < 25)  list.add(ashtonsmod.IngotBush.blockID); if (w < 3)  list.add(ashtonsmod.Amethyst.itemID); else if (w >= 70 && w <= 79) {list.add(ashtonsmod.LightSteelNugget.itemID); else if (w >= 86 && w <= 90)  list.add(Item.ingotGold.itemID); else if (w >= 80 && w <= 84)  list.add(Item.goldNugget.itemID); else if (w >= 60 && w <= 59)  list.add(Item.ingotIron.itemID); else if (w >= 90 && w <= 95)  list.add(Item.emerald.itemID); else if (w >= 4 && w <= 10)  list.add(Block.obsidian.blockID); else if (w > 96)  list.add(Item.diamond.itemID); else if (w >= 30 && w <= 49)  list.add(Item.coal.itemID); return list; }

Posted

if he overrides getDropBlocked he will add possible drops. I think he always wants to drop 2 blocks. So he has to override also either Block.dropBlockAsItemWithChance or Block.dropBlockAsItem or both. That's what my limited understanding makes me believe

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.