Possible to drop exp from a block onBlockBreak?

Discussion in 'Plugin Development' started by iPhysX, Nov 28, 2011.

Thread Status:
Not open for further replies.
  1. Offline


    It would be really handy if this was possible :D Im sure if it is somebody will know how :D
  2. Offline


    Yes. Create experience orbs, set their experience amounts, and drop naturally at the old block's location. Voi la.
  3. Offline


    yeah i got it with this :)
    1. b.getLocation().getWorld().spawn(b.getLocation(), ExperienceOrb.class).setExperience(1);

    Is it possible to use anything except an int.. for the setExperience(1); because that is too much experience for what im trying to do, at the moment i'm using a random to decide if there should be an exp drop but it would be better if i could drop 1/10th of the exp :/
  4. Offline


    I am pretty sure experience itself is an integer. I am at work right now and only going off of memory. How I handled this is by using a random number to determine if the orb drops, thus reducing the amount of orbs that drop all together. By doing this you effectively reduce the amount of total experience that a player obtains from mining. So for your specified number, pull a random number from 1 to 10 and if number is 1 then drop orb = 1/10th experience.
    iPhysX likes this.
Thread Status:
Not open for further replies.

Share This Page