13
0
geforkt von Mirrors/Paper

Fix zero reputation deleting villagers (#3857)

Dieser Commit ist enthalten in:
Mariell 2020-07-17 19:47:04 +02:00
Ursprung 518ae65609
Commit 827e6cec16
2 geänderte Dateien mit 8 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -76,11 +76,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ public void assignFromPaperReputation(com.destroystokyo.paper.entity.villager.Reputation rep) { + public void assignFromPaperReputation(com.destroystokyo.paper.entity.villager.Reputation rep) {
+ this.a.put(net.minecraft.server.ReputationType.MAJOR_NEGATIVE, rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.MAJOR_NEGATIVE)); + int val;
+ this.a.put(net.minecraft.server.ReputationType.MAJOR_POSITIVE, rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.MAJOR_POSITIVE)); + if ((val = rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.MAJOR_NEGATIVE)) != 0) this.a.put(ReputationType.MAJOR_NEGATIVE, val);
+ this.a.put(net.minecraft.server.ReputationType.MINOR_NEGATIVE, rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.MINOR_NEGATIVE)); + if ((val = rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.MAJOR_POSITIVE)) != 0) this.a.put(ReputationType.MAJOR_POSITIVE, val);
+ this.a.put(net.minecraft.server.ReputationType.MINOR_POSITIVE, rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.MINOR_POSITIVE)); + if ((val = rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.MINOR_NEGATIVE)) != 0) this.a.put(ReputationType.MINOR_NEGATIVE, val);
+ this.a.put(net.minecraft.server.ReputationType.TRADING, rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.TRADING)); + if ((val = rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.MINOR_POSITIVE)) != 0) this.a.put(ReputationType.MINOR_POSITIVE, val);
+ if ((val = rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.TRADING)) != 0) this.a.put(ReputationType.TRADING, val);
+ } + }
+ // Paper end + // Paper end
} }

Datei anzeigen

@ -17,7 +17,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ List<Reputation.b> list = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(); + List<Reputation.b> list = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>();
+ for (Map.Entry<UUID, Reputation.a> entry : getReputations().entrySet()) { + for (Map.Entry<UUID, Reputation.a> entry : getReputations().entrySet()) {
+ for (Reputation.b cur : entry.getValue().decompress(entry.getKey())) { + for (Reputation.b cur : entry.getValue().decompress(entry.getKey())) {
+ list.add(cur); + if (cur.a() != 0)
+ list.add(cur);
+ } + }
+ } + }
+ return list; + return list;