Jump to content

[1.6.4] How i can catch the mob, who dropped experience orb?


Try4W

Recommended Posts

Do you mean to do something whenever a mob drops experience?

 

You can use LivingDropsEvent or PlayerPickupXpEvent. I'm not exactly sure what you want to do, but these seem like a good place to start.

BEFORE ASKING FOR HELP READ THE EAQ!

 

I'll help if I can. Apologies if I do something obviously stupid. :D

 

If you don't know basic Java yet, go and follow these tutorials.

Link to comment
Share on other sites

Do you mean to do something whenever a mob drops experience?

 

You can use LivingDropsEvent or PlayerPickupXpEvent. I'm not exactly sure what you want to do, but these seem like a good place to start.

 

Nope, but thanks. I wanna remove experience orbs if it will drop, for example from creeper. But mobs drops orbs with this stupid metod:

    protected void onDeathUpdate()
    {
        ++this.deathTime;

        if (this.deathTime == 20)
        {
            int i;

            if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && !this.isChild() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot"))
            {
                i = this.getExperiencePoints(this.attackingPlayer);

                // !
                while (i > 0)
                {
                    int j = EntityXPOrb.getXPSplit(i);
                    i -= j;
                    this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j));
                }
            }

            this.setDead();

            for (i = 0; i < 20; ++i)
            {
                double d0 = this.rand.nextGaussian() * 0.02D;
                double d1 = this.rand.nextGaussian() * 0.02D;
                double d2 = this.rand.nextGaussian() * 0.02D;
                this.worldObj.spawnParticle("explode", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2);
            }
        }
    }

Link to comment
Share on other sites

Since Experience Orbs are entities I'd assume they're still spawned, so you can mess around with things like LivingSpawnEvent.CheckSpawn or LivingSpawnEvent.SpecialSpawn.

 

Maybe even the EntityConstructingEvent.

 

Another option might be to subscribe to LivingDeathEvent, and then make it die in a way that you define, that might work.

 

The last resort I can think of right now is that if none of the above work, you can try using the spawn events to make every creeper spawned actually spawn an instance of your own creeper class that extends EntityCreeper or whatever its called, and then override that method there. This would probably be a bad idea though, as it can mess with compatibility with other mods.

BEFORE ASKING FOR HELP READ THE EAQ!

 

I'll help if I can. Apologies if I do something obviously stupid. :D

 

If you don't know basic Java yet, go and follow these tutorials.

Link to comment
Share on other sites

Since Experience Orbs are entities I'd assume they're still spawned, so you can mess around with things like LivingSpawnEvent.CheckSpawn or LivingSpawnEvent.SpecialSpawn.

 

Maybe even the EntityConstructingEvent.

 

Another option might be to subscribe to LivingDeathEvent, and then make it die in a way that you define, that might work.

 

If I understand correctly, these methods do not give 100% accurate.

 

The last resort I can think of right now is that if none of the above work, you can try using the spawn events to make every creeper spawned actually spawn an instance of your own creeper class that extends EntityCreeper or whatever its called, and then override that method there. This would probably be a bad idea though, as it can mess with compatibility with other mods.

This method may not be compatible with other mods. I create some constructor for change drops of mobs. It must works with all mobs.

 

Maybe I should read about ASM-lib and somehow insert custom xp-drop event in the method OnDathUpdate?

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.