testserver/Spigot-Server-Patches/0495-Villager-Restocks-API....

51 lines
1.8 KiB
Diff

From 6a37d7c6bd64ccfbb2d061af1cabb3c64b0cef8c Mon Sep 17 00:00:00 2001
From: zbk <zbk@projectsolaris.net>
Date: Sun, 26 Apr 2020 23:49:01 -0400
Subject: [PATCH] Villager Restocks API
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index 6e0020ae0b..ef2ee68cd6 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -977,4 +977,13 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
return optional.isPresent() && optional1.isPresent() ? i - ((MinecraftSerializableLong) optional.get()).a() < 24000L && i - ((MinecraftSerializableLong) optional1.get()).a() < 36000L : false;
}
+
+ // Paper start
+ public int getRestocksToday(){
+ return this.bL;
+ }
+ public void setRestocksToday(int restocksToday){
+ this.bL = restocksToday;
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index fe726e7884..a8384081c0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -82,6 +82,18 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
getHandle().setExperience(experience);
}
+ // Paper start
+ @Override
+ public int getRestocksToday() {
+ return getHandle().getRestocksToday();
+ }
+
+ @Override
+ public void setRestocksToday(int restocksToday) {
+ getHandle().setRestocksToday(restocksToday);
+ }
+ // Paper end
+
@Override
public boolean sleep(Location location) {
Preconditions.checkArgument(location != null, "Location cannot be null");
--
2.26.2