aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0384-Villager-Restocks-API.patch
blob: b263d39f2a2cf613bad1072253855569ab8f4b46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From 0000000000000000000000000000000000000000 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

== AT ==
public net.minecraft.world.entity.npc.Villager numberOfRestocksToday

diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index 6ee10f8a30041355a1fb0b805c7c61b7ac4ad5af..fb9f1fa2f66dbeb1ffea2679d6efe47ed616f0ab 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -87,6 +87,18 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
         this.getHandle().setVillagerXp(experience);
     }
 
+    // Paper start
+    @Override
+    public int getRestocksToday() {
+        return getHandle().numberOfRestocksToday;
+    }
+
+    @Override
+    public void setRestocksToday(int restocksToday) {
+        getHandle().numberOfRestocksToday = restocksToday;
+    }
+    // Paper end
+
     @Override
     public boolean sleep(Location location) {
         Preconditions.checkArgument(location != null, "Location cannot be null");