How would I make it so that nothing can spawn experience orbs

Started by _celestialstars9_ on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2026
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How would I make it so that nothing can spawn experience orbs

I'm changing the way experience is obtained so I don't want experience orbs to be dropped. How would I make it so that they aren't spawned in the first place?

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You could just delete every…
Sun, 02/08/2026 - 06:50

You could just delete every experience orb in a tick procedure but ig that would be a unprofessional approach.

I am pretty sure you cannot overwrite this part of Minecrafts code without custom code.
I never tested it but the most interesting code section could look something like this:

@SubscribeEvent
public static void onLivingDrops(LivingDropsEvent event) {
    if (event.getEntity() instanceof EntityLivingBase && !(event.getEntity() instanceof EntityPlayer)) {
        event.setCanceled(true); //this part would contain a filter mechanism for xp orbs
    }
}

Basically, when an entity drops anything, you cancel the trigger which negates it.
What that means is, that will not drop anything. As I am not a good programmer myself, I have no clue how to implement a filter for xp orbs. Maybe AI can help out...
Also you would have to find a way to cancel the trigger for xp drops from ovens and stuff like that.

Edit:
I just discovered that there is a trigger for an entity dropping experience in the blockly editor and it is cancellable...
Soooooo just create a procedure with the trigger "Entity drops experience" and then search in the Advanced tab for the cancel block. That should be it for entities.
Anyways, unfortunately there is no trigger for "Block drops experience" so ig that would have to be custom made. Maybe there is a similar approach like the one shown above but for blocks...

I still hope I could help ya :D