aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0482-Add-villager-reputation-API.patch
diff options
context:
space:
mode:
authorMariell <[email protected]>2020-07-17 19:47:04 +0200
committerGitHub <[email protected]>2020-07-17 13:47:04 -0400
commit108efeeeff5b8b55998113a0df1553e3bf56064d (patch)
tree9d09db54294fa955bb0d78977ec2fbe2895c85ef /Spigot-Server-Patches/0482-Add-villager-reputation-API.patch
parent7db30ebd5768fa12251a017711d41ebfdc96c658 (diff)
downloadPaper-108efeeeff5b8b55998113a0df1553e3bf56064d.tar.gz
Paper-108efeeeff5b8b55998113a0df1553e3bf56064d.zip
Fix zero reputation deleting villagers (#3857)
Diffstat (limited to 'Spigot-Server-Patches/0482-Add-villager-reputation-API.patch')
-rw-r--r--Spigot-Server-Patches/0482-Add-villager-reputation-API.patch15
1 files changed, 8 insertions, 7 deletions
diff --git a/Spigot-Server-Patches/0482-Add-villager-reputation-API.patch b/Spigot-Server-Patches/0482-Add-villager-reputation-API.patch
index 1709aec599..a4b89e4b69 100644
--- a/Spigot-Server-Patches/0482-Add-villager-reputation-API.patch
+++ b/Spigot-Server-Patches/0482-Add-villager-reputation-API.patch
@@ -32,7 +32,7 @@ index 9f28c7e4bd70abc280a8cf3cbf5ccc84246aff12..bf019043a9338aca8d91da809f1d5520
return this.bF;
}
diff --git a/src/main/java/net/minecraft/server/Reputation.java b/src/main/java/net/minecraft/server/Reputation.java
-index 3c6d6be4485cad4f2e9a395425b5837590853eee..28c9f9ed2d532a1eb14b74c2e9723a2cf1b3c6fa 100644
+index 3c6d6be4485cad4f2e9a395425b5837590853eee..09d2fc5769089f6d29971d10de5b8209829baae8 100644
--- a/src/main/java/net/minecraft/server/Reputation.java
+++ b/src/main/java/net/minecraft/server/Reputation.java
@@ -25,7 +25,7 @@ import java.util.stream.Stream;
@@ -58,7 +58,7 @@ index 3c6d6be4485cad4f2e9a395425b5837590853eee..28c9f9ed2d532a1eb14b74c2e9723a2c
this.a = new Object2IntOpenHashMap();
}
-@@ -198,6 +198,27 @@ public class Reputation {
+@@ -198,6 +198,28 @@ public class Reputation {
public void b(ReputationType reputationtype) {
this.a.removeInt(reputationtype);
}
@@ -76,11 +76,12 @@ index 3c6d6be4485cad4f2e9a395425b5837590853eee..28c9f9ed2d532a1eb14b74c2e9723a2c
+ }
+
+ 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
}