death to more obfhelpers

This commit is contained in:
MiniDigger 2021-06-17 22:20:03 +02:00
parent 272fb20b26
commit 13e04200c7
14 changed files with 48 additions and 152 deletions

View file

@ -61,20 +61,8 @@ index 2e342e1c258180dc02080f76385351c0a65eade2..39c0fbae8b94dabd27ee8687015557c6
}
static class GossipEntry {
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 29d8448e1e38c571f6c0019fcb45a9df82eabbe5..2a3dcabead39d74532613b8fc28924ec251e2d85 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -1080,6 +1080,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
this.numberOfRestocksToday = 0;
}
+ @Deprecated public GossipContainer getReputation() { return this.getGossips(); } // Paper - OBFHELPER
public GossipContainer getGossips() {
return this.gossips;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index 6b16bb1226515b8cbb477e62b617ee1a7f5ef8ed..f2cfce5cc18776c4dfd162b699661c9bee725f01 100644
index fe3a73e9cdb85fdf8385f0a0d096a991541cbf60..aa6d3ff2abc9f0c65dd51b2a30d327fea827bb42 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -16,6 +16,13 @@ import org.bukkit.entity.Villager;
@ -99,7 +87,7 @@ index 6b16bb1226515b8cbb477e62b617ee1a7f5ef8ed..f2cfce5cc18776c4dfd162b699661c9b
+ // Paper start - Add villager reputation API
+ @Override
+ public Reputation getReputation(UUID uniqueId) {
+ net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips rep = getHandle().getReputation().getReputations().get(uniqueId);
+ net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips rep = getHandle().getGossips().getReputations().get(uniqueId);
+ if (rep == null) {
+ return new Reputation(Maps.newHashMap());
+ }
@ -109,7 +97,7 @@ index 6b16bb1226515b8cbb477e62b617ee1a7f5ef8ed..f2cfce5cc18776c4dfd162b699661c9b
+
+ @Override
+ public Map<UUID, Reputation> getReputations() {
+ return getHandle().getReputation().getReputations().entrySet()
+ return getHandle().getGossips().getReputations().entrySet()
+ .stream()
+ .collect(java.util.stream.Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().getPaperReputation()));
+ }
@ -117,7 +105,7 @@ index 6b16bb1226515b8cbb477e62b617ee1a7f5ef8ed..f2cfce5cc18776c4dfd162b699661c9b
+ @Override
+ public void setReputation(UUID uniqueId, Reputation reputation) {
+ net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips nmsReputation =
+ getHandle().getReputation().getReputations().computeIfAbsent(
+ getHandle().getGossips().getReputations().computeIfAbsent(
+ uniqueId,
+ key -> new net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips()
+ );
@ -133,7 +121,7 @@ index 6b16bb1226515b8cbb477e62b617ee1a7f5ef8ed..f2cfce5cc18776c4dfd162b699661c9b
+
+ @Override
+ public void clearReputations() {
+ getHandle().getReputation().getReputations().clear();
+ getHandle().getGossips().getReputations().clear();
+ }
+ // Paper end
}