public static int getExperienceDrop(EntityLivingBase entity, EntityPlayer attackingPlayer, int originalExperience) { LivingExperienceDropEvent event = new LivingExperienceDropEvent(entity, attackingPlayer, originalExperience); if (MinecraftForge.EVENT_BUS.post(event)) { return 0; } return event.getDroppedExperience(); }
@SubscribeEvent public void dropExperience(LivingExperienceDropEvent event) { if (!event.getEntity().getTags().contains(NemesisSystem.TAG_NEMESIS)) { return; } NemesisEntry nemesis = NemesisUtil.loadNemesisFromEntity(event.getEntity()); if (nemesis == null) { return; } event.setDroppedExperience(10 + (5 * (nemesis.getLevel() - 1))); }
@SubscribeEvent public void addMoreMobXP(LivingExperienceDropEvent event){ if(event.getAttackingPlayer() == null)return; EntityPlayer player = event.getAttackingPlayer(); if(getArmorCount(player, "green") == 4 || getArmorCount(player, "pure") == 4){ final int oldXP = event.getDroppedExperience(); float dev = (float)EntityUtil.rand.nextInt(50) / (float)50; int add = (int) (oldXP * dev); //ModLogger.info("Added Mob XP: "+add+" / "+dev+" "+oldXP); event.setDroppedExperience(add + oldXP); } }
@SubscribeEvent public void onXpDrop(LivingExperienceDropEvent event) { EntityPlayer player = event.getAttackingPlayer(); if (player != null && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier) && event.getDroppedExperience() > 0) { event.setDroppedExperience(this.getUpdateXP(event.getDroppedExperience())); } }
@SubscribeEvent public void onXpDrop(LivingExperienceDropEvent event) { if (!event.getEntity().getEntityWorld().isRemote) { EntityPlayer player = event.getAttackingPlayer(); float r = random.nextFloat(); if (player != null && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier)) { if (r <= 0.80) { event.setDroppedExperience(0); } else { event.setDroppedExperience(event.getDroppedExperience() * (random.nextInt(3) + 2)); } } } }