August 8, 201411 yr 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. If you don't know basic Java yet, go and follow these tutorials.
August 9, 201411 yr Author 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); } } }
August 9, 201411 yr 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. If you don't know basic Java yet, go and follow these tutorials.
August 9, 201411 yr Author 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?
August 9, 201411 yr You could create your own event and make a PR on the official github. BEFORE ASKING FOR HELP READ THE EAQ! I'll help if I can. Apologies if I do something obviously stupid. If you don't know basic Java yet, go and follow these tutorials.
August 9, 201411 yr Author You could create your own event and make a PR on the official github. I'll try in the near future.
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.