# Fortune Calculator

Discussion in 'Plugin Development' started by Starfire1337, Jul 28, 2014.

Not open for further replies.
1. Offline

### Starfire1337

How would I be able to calculate fortune if I mine a diamond ore with a fortune pick? I need a method that would take x as the fortune level, as I have a few enchants that have fortune 1000. Is there something that could do this?

#1
2. Offline

#2
3. Offline

### Starfire1337

xTigerRebornx
If I'm reading correctly, you could be getting hundreds of blocks following that algorithm if you have level 100+ enchants. Is there a way for the following:
Level 100: 13-15
Level 200: 30-36
etc.
I just can't figure out a way to do it :/

#3
4. Offline

### xTigerRebornx

Starfire1337 Use your own method for determining the drops, create your own algorithm that matches the results you want.

Edit: Fortune 100 can give ~100 diamonds when an ore is mined, so it does simulate fortune properly.

#4
5. Offline

### Starfire1337

xTigerRebornx
Will
Code:java
` public int getLuck(int level) {Random random = new Random();int Item = random.nextInt(4) + 1;if(level >= 30) {int max = level / 6;int least = level / 7;Item = random.nextInt(max) + least;}return Item;} `

work correctly?
I don't really care about low-level enchants, because the server will barely have them

#5
6. Offline

### xTigerRebornx

Starfire1337 Test it and see if it drops the amount you want. If it doesn't, change it up to your liking.

#6
7. Offline

#7