aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0065-Configurable-container-update-tick-rate.patch
blob: ffb264671d5d80c86a009f09ba4636512d6dedc3 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 54a6f2217b848ae8f4a01a8315e5266feac87dc8 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Thu, 23 Jul 2015 22:05:22 -0700
Subject: [PATCH] Configurable container update tick rate


diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 3e4869b..0c49a25 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -65,6 +65,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
     // Spigot start
     public boolean collidesWithEntities = true;
     public int viewDistance; // PaperSpigot - Player view distance API
+    private int containerUpdateDelay; // PaperSpigot
 
     @Override
     public boolean ad()
@@ -197,8 +198,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
         if (this.noDamageTicks > 0) {
             --this.noDamageTicks;
         }
-
-        this.activeContainer.b();
+        
+        // PaperSpigot start - Configurable container update tick rate
+        if (--containerUpdateDelay <= 0) {
+            this.activeContainer.b();
+            containerUpdateDelay = world.paperSpigotConfig.containerUpdateTickRate;
+        }
+        // PaperSpigot end
         if (!this.world.isClientSide && !this.activeContainer.a((EntityHuman) this)) {
             this.closeInventory();
             this.activeContainer = this.defaultContainer;
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 54f432d..f1409cf 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -364,4 +364,10 @@ public class PaperSpigotWorldConfig
     {
         cacheChunkMaps = getBoolean( "cache-chunk-maps", false );
     }
+
+    public int containerUpdateTickRate;
+    private void containerUpdateTickRate()
+    {
+        containerUpdateTickRate = getInt( "container-update-tick-rate", 1 );
+    }
 }
-- 
2.7.0