Jump to content

hostile vs. peaceful experienceValue wierdness


acecase

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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