[SPIGOT-2420] Can't set exp drops to EnderDragon when is death Created: 15/Jun/16  Updated: 18/Jun/22  Resolved: 18/Jun/22

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Matt Assignee: Marvin Rieple
Resolution: Fixed Votes: 2
Labels: None
Environment:

OS: Ubuntu 12.04
Spigot: 1.10


Issue Links:
Duplicate
is duplicated by SPIGOT-5229 Cannot set droppedEXP on Enderdragon Resolved

 Description   

Title say all, no errors in console only my plugin. The dragon the first time drops 68 level, the next times 19 but with this event I should change the level but remains constant!

        private int random(int min, int max){
		return (int) ((Math.random() * max) + min);
	}
	
	@EventHandler(priority=EventPriority.NORMAL, ignoreCancelled=true)
	public void onEntityDeath(EntityDeathEvent ev){
		Entity e = ev.getEntity();
		
		if(e instanceof EnderDragon){
			ev.setDroppedExp(0);
		}else
			return;
	}


 Comments   
Comment by Marvin Rieple [ 12/Jun/22 ]

Made a PR for this: craftbukkit#1069

Comment by nosxxx [ 15/Oct/16 ]

Is there any update ?

Comment by minoneer [ 17/Jul/16 ]

Those magic values are the total amount of XP dropped during the diing phase. 12000 for the first dragon killed, 500 for any following.

Experience drops:
exp = 500 (12000 for first dragon)
tick = tick since death

if tick > 150 and tick % 5 == 0 -> drop 0.08*exp experience
if tick == 200 -> drop 0.2*exp experience

=> (10 * 0.08*exp) + (1 * 0.02*exp) = exp

The dragon drops 8% of it's XP each 5 ticks during the last 50 ticks of it's diing process, plus an additional 20% at the very end.

Comment by md_5 [ 16/Jun/16 ]

I mean I guess we could add an experience override API for ender dragons, but someone would need to figure out the meaning of the magic values 500 and 12000 for first kill...

Comment by md_5 [ 16/Jun/16 ]

Right. Ender dragons are special in the sense that the experience they drop is calculated based on their lifetime etc, and not just random like normal mobs.
In addition to this, the ender dragon actually dies over the span of 200 ticks (10 seconds), and drops experience each of these ticks.
It isn't possible to tie that into the death event....

Generated at Sat Dec 13 13:38:36 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.