From 827e6cec1634543d00a6b8072f644c687f68cf3d Mon Sep 17 00:00:00 2001 From: Mariell Date: Fri, 17 Jul 2020 19:47:04 +0200 Subject: [PATCH] Fix zero reputation deleting villagers (#3857) --- .../Add-villager-reputation-API.patch | 11 ++++++----- ...streams-from-classes-related-villager-gossip.patch | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Spigot-Server-Patches/Add-villager-reputation-API.patch b/Spigot-Server-Patches/Add-villager-reputation-API.patch index 46409b3cdb..f225f10952 100644 --- a/Spigot-Server-Patches/Add-villager-reputation-API.patch +++ b/Spigot-Server-Patches/Add-villager-reputation-API.patch @@ -76,11 +76,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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)); -+ this.a.put(net.minecraft.server.ReputationType.MAJOR_POSITIVE, rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.MAJOR_POSITIVE)); -+ this.a.put(net.minecraft.server.ReputationType.MINOR_NEGATIVE, rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.MINOR_NEGATIVE)); -+ this.a.put(net.minecraft.server.ReputationType.MINOR_POSITIVE, rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.MINOR_POSITIVE)); -+ this.a.put(net.minecraft.server.ReputationType.TRADING, rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.TRADING)); ++ int val; ++ if ((val = rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.MAJOR_NEGATIVE)) != 0) this.a.put(ReputationType.MAJOR_NEGATIVE, val); ++ if ((val = rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.MAJOR_POSITIVE)) != 0) this.a.put(ReputationType.MAJOR_POSITIVE, val); ++ if ((val = rep.getReputation(com.destroystokyo.paper.entity.villager.ReputationType.MINOR_NEGATIVE)) != 0) this.a.put(ReputationType.MINOR_NEGATIVE, val); ++ 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 } diff --git a/Spigot-Server-Patches/Remove-streams-from-classes-related-villager-gossip.patch b/Spigot-Server-Patches/Remove-streams-from-classes-related-villager-gossip.patch index c1ed6f35a8..2cb459c17a 100644 --- a/Spigot-Server-Patches/Remove-streams-from-classes-related-villager-gossip.patch +++ b/Spigot-Server-Patches/Remove-streams-from-classes-related-villager-gossip.patch @@ -17,7 +17,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + List list = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(); + for (Map.Entry entry : getReputations().entrySet()) { + for (Reputation.b cur : entry.getValue().decompress(entry.getKey())) { -+ list.add(cur); ++ if (cur.a() != 0) ++ list.add(cur); + } + } + return list;