aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0050-Configurable-container-update-tick-rate.patch
blob: 02f5fc8fd0e48d5cbc59cf746b8b5f90b3c42360 (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
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Wed, 2 Mar 2016 23:34:44 -0600
Subject: [PATCH] Configurable container update tick rate


diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 911ec630c5925b160cc05f99f0d5bb5ac46384bb..78e4f07019e3231fbaa3f23bcdc8846e2d79ae18 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -295,6 +295,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
     private final CommandSource commandSource;
     private int containerCounter;
     public boolean wonGame;
+    private int containerUpdateDelay; // Paper - Configurable container update tick rate
 
     // CraftBukkit start
     public CraftPlayer.TransferCookieConnection transferCookieConnection;
@@ -924,7 +925,12 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
             --this.invulnerableTime;
         }
 
-        this.containerMenu.broadcastChanges();
+        // Paper start - Configurable container update tick rate
+        if (--containerUpdateDelay <= 0) {
+            this.containerMenu.broadcastChanges();
+            containerUpdateDelay = this.level().paperConfig().tickRates.containerUpdate;
+        }
+        // Paper end - Configurable container update tick rate
         if (!this.level().isClientSide && !this.containerMenu.stillValid(this)) {
             this.closeContainer();
             this.containerMenu = this.inventoryMenu;