Skip to content

Commit

Permalink
Simplify experienced logic and remove edge case of modifier not added
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightMiner committed Dec 24, 2022
1 parent cbc3a1b commit 1b87363
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -75,7 +75,7 @@ private void onEntityKilled(LivingDeathEvent event) {
*/
private void onExperienceDrop(LivingExperienceDropEvent event) {
// if the entity was killed by one of our arrows, boost the experience from that
int experienced = event.getEntityLiving().getCapability(TinkerDataCapability.CAPABILITY).resolve().stream().mapToInt(data -> data.get(EXPERIENCED, -1)).sum();
int experienced = event.getEntityLiving().getCapability(TinkerDataCapability.CAPABILITY).resolve().map(data -> data.get(EXPERIENCED)).orElse(-1);
if (experienced > 0) {
event.setDroppedExperience(boost(event.getDroppedExperience(), experienced));
// experienced being zero means it was our arrow but it was not modified, do not check the held item in that case
Expand Down

0 comments on commit 1b87363

Please sign in to comment.