Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

This is a repost of the last variation on my last post, but that one started as something totally different and noone is reading it anymore, so I am reposting the current issue.

 

I am trying to stop xp orb drops from mobs and animals without effecting other things, like furnaces.

 

I have created an event handler for the LivingDeath event and here is my code (simple enough to just explain but people like code)

 

 

public class LivingDeathHandler {
@ForgeSubscribe
        public void onLivingDeath(LivingDeathEvent e){
               e.entityLiving.experienceValue = 0;
        }
}

 

 

 

For some reason, beyond me, hostile mobs will not spawn xp orbs, but peaceful mobs still will.

I looked at a pig's experienceValue before I set it to 0, and it is 0 by default, so they must be using a different system, but I traced the EntityPig class up the chain to the EntityLiving class, and I don't see where, other than EntityLiving, the pig could be inheriting the experienceValue property or any other method to drop xp orbs.

 

Any help would be appriciated. This is the final piece to a mod I have been working on for a while.

 

Thanks

  • Author

An update, in case anyone is looking at this for me.

 

I have greped out all files in src/minecraft/net/minecraft that contain both XPOrb and spawn, and this is the result.

 

 

 

block/Block.java:                par1World.spawnEntityInWorld(new EntityXPOrb(par1World, (double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, var6));

entity/ai/EntityAIMate.java:            this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, var2.nextInt(7) + 1));

entity/item/EntityExpBottle.java:                this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, var3));

entity/projectile/EntityFishHook.java:                this.angler.worldObj.spawnEntityInWorld(new EntityXPOrb(this.angler.worldObj, this.angler.posX, this.angler.posY + 0.5D, this.angler.posZ + 0.5D, this.rand.nextInt(6) + 1));

entity/boss/EntityDragon.java:                    this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, var5));

entity/boss/EntityDragon.java:                this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, var5));

entity/EntityLiving.java:                        this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, var2));

inventory/SlotFurnace.java:                this.thePlayer.worldObj.spawnEntityInWorld(new EntityXPOrb(this.thePlayer.worldObj, this.thePlayer.posX, this.thePlayer.posY + 0.5D, this.thePlayer.posZ + 0.5D, var4));

 

 

 

So, I'm still lost. With a value of 0 for experienceValue, an EntityLiving should drop no xp orbs from what I can see.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.