# [HELP]Increase Random Mob Drops

## Recommended Posts

I understand how to make the mob drops 0-2 dropping only 1 out of 2 and sometimes nothing, but how would I increase that number to say 10? 1-10 and only 1 out of 10 items? This is what I have now.

protected void dropFewItems(boolean par1, int par2)

{

int random = this.rand.nextInt(4) + this.rand.nextInt(1 + par2);

for (int k = 0; k < random; ++k)

{

if(k == 2){

}

else

if (k == 1){

this.dropItem(PhantasyRealmsItems.brand, 1);

}

##### Share on other sites

Well, just change how you calculate the number. Random.nextInt(n) gives you a number between 0 (inclusive) and n (exclusive).

So Random.nextInt(3) gives you 0, 1 or 2. Then just use math to get to the range you want.

yes but when I try to add on to this

for (int k = 0; k < random; ++k)

{

if(k == 2){

}

else

if (k == 1){

this.dropItem(PhantasyRealmsItems.brand, 1);

}

else

if (k == 3){

this.dropItem(PhantasyRealmsItems.brand, 1);

}

and so on it just makes killing the mob  drop both items after the first else.. I dont know Im at a loss for what to do after setting Random.nextInt(n) to a higher number.

##### Share on other sites

Well, you used a 'for' loop, so if random is 3, you will drop both items '1' and '2'. Perhaps Java tutorials are in order?

##### Share on other sites

Well, you used a 'for' loop, so if random is 3, you will drop both items '1' and '2'. Perhaps Java tutorials are in order?

Fair enough and perhaps though an answer would be nice too.

##### Share on other sites

So you have 10 possible drops. You want to drop only 1 of those at every given time and then 1-10 of that selected Item?

yes

##### Share on other sites

First select the drop type, it's a number from 0-9 (10 possible types):

`int dropType = rand.nextInt(10);`

Then select how many of that Item to drop (1-10):

`int dropAmount = 1 + rand.nextInt(10);`

Then switch on the drop type and drop the selected amount of it. This is not hard.

No sorry, I read your comment wrong, there are 10 possible Items a mob can drop, each time a mob is killed 1 out of those 10 items is dropped.

##### Share on other sites

Then just remove the drop amount part. Just select the drop type and drop it...

Thanks, I know it may seem basic to you guys but I learn by trial and error and by actually testing with things not just reading about them, and I appreciate you helping me out. Thank you

##### Share on other sites

Switch statement - read it, then USE it and experiment with it until you understand how it works.

Once you do, get rid of that for loop you have and replace it with a switch statement on the random number generated for drop type, and return a specific drop for each case that you want.

## 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.

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

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

• ### Posts

• Very first search result on google when I search for "minecraft jinryuujrmcore": https://www.curseforge.com/minecraft/mc-mods/jingames-jrmcore
• You will need to upload your logs somewhere on the internet, and link to them here. The links you have provided (file://) are for files on your local filesystem, which we cannot access. The FAQ link at the top of the page has information on paste sites you can use to share your logs.
• Well, I wanted to play Dragon Block C and suddenly this appeared when I tried to use Forge 1.7.10, now I don't know what I can do, I tried searching on YouTube or Google and nothing so I decided to come here to try to solve it.

• ### Who's Online (See full list)

×

• #### Activity

×
• Create New...