Skip to content

Commit

Permalink
Calculate major positive reputation even if player has no gossip
Browse files Browse the repository at this point in the history
For some reason the override for getting reputation would exit
if no reputation was found for the target player and return zero.
This has been amended to continue summing the major positive
reputation of all players and returning that result.
  • Loading branch information
totorewa committed Mar 14, 2021
1 parent 25859d1 commit 41b2411
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ public abstract class VillagerGossipsMixin {
public void overrideReputation(UUID target, Predicate<VillageGossipType> filter, CallbackInfoReturnable<Integer> cir) {
if (TotoCarpetSettings.sharedVillagerDiscounts && filter.test(MAJOR_POSITIVE)) {
VillagerGossips$ReputationInvoker targetReputation = (VillagerGossips$ReputationInvoker)entityReputation.get(target);
if (targetReputation == null) {
cir.setReturnValue(0);
return;
int otherRep = 0;
if (targetReputation != null) {
otherRep = targetReputation.toto$getValueFor(vgt -> filter.test(vgt) && !vgt.equals(MAJOR_POSITIVE));
}
int otherRep = targetReputation.toto$getValueFor(vgt -> filter.test(vgt) && !vgt.equals(MAJOR_POSITIVE));
int majorPositiveRep = entityReputation.values()
.stream()
.mapToInt(r -> ((VillagerGossips$ReputationInvoker) r).toto$getValueFor(vgt -> vgt.equals(MAJOR_POSITIVE)))
Expand Down

0 comments on commit 41b2411

Please sign in to comment.