Fortune Calculator

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

Thread Status:
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?
     
  2. Offline

    xTigerRebornx

  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 :/
     
  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.
     
  5. Offline

    Starfire1337

    xTigerRebornx
    Will
    Code:java
    1.  
    2. public int getLuck(int level) {
    3. Random random = new Random();
    4. int Item = random.nextInt(4) + 1;
    5. if(level >= 30) {
    6. int max = level / 6;
    7. int least = level / 7;
    8. Item = random.nextInt(max) + least;
    9. }
    10. return Item;
    11. }
    12.  

    work correctly?
    I don't really care about low-level enchants, because the server will barely have them
     
  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.
     
  7. Offline

    Starfire1337

Thread Status:
Not open for further replies.

Share This Page