Skip to content

Commit

Permalink
Directing: Fix XP-Orb spawning with 0 xp
Browse files Browse the repository at this point in the history
  • Loading branch information
Flo56958 committed Oct 5, 2023
1 parent 3277326 commit 7ec843b
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public void effect(MTBlockBreakEvent event) {

if (this.workOnXP && modManager.getModLevel(tool, this) >= this.minimumLevelForXP) {
//Spawn Experience Orb as adding it directly to the player would prevent Mending from working
if (event.getEvent().getExpToDrop() <= 0) return;
ExperienceOrb orb = (ExperienceOrb) player.getWorld().spawnEntity(player.getLocation(), EntityType.EXPERIENCE_ORB);
orb.setExperience(event.getEvent().getExpToDrop());
event.getEvent().setExpToDrop(0);
Expand Down Expand Up @@ -222,6 +223,7 @@ public void effect(MTEntityDeathEvent event) {

if (this.workOnXP && modManager.getModLevel(tool, this) >= this.minimumLevelForXP) {
//Spawn Experience Orb as adding it directly to the player would prevent Mending from working
if (event.getEvent().getDroppedExp() <= 0) return;
ExperienceOrb orb = (ExperienceOrb) player.getWorld().spawnEntity(player.getLocation(), EntityType.EXPERIENCE_ORB);
orb.setExperience(event.getEvent().getDroppedExp());
event.getEvent().setDroppedExp(0);
Expand Down

0 comments on commit 7ec843b

Please sign in to comment.