Paper/patches/server/0042-Configurable-container-update-tick-rate.patch
2021-11-30 19:26:33 +01:00

47 lines
2.1 KiB
Diff

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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index e7b7f0a1a35f782a0da4627b4f02e673ca73693e..1b51f717ec2a0538d9037dd1d4328030bd9122c8 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -227,4 +227,9 @@ public class PaperWorldConfig {
private void mobSpawnerTickRate() {
mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1);
}
+
+ public int containerUpdateTickRate;
+ private void containerUpdateTickRate() {
+ containerUpdateTickRate = getInt("container-update-tick-rate", 1);
+ }
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 4689d52cd314a607d17be3657099157e95f34d47..3a97690a1e65db9a1c184fa4df5899cfda3d44bc 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -220,6 +220,7 @@ public class ServerPlayer extends Player {
private int containerCounter;
public int latency;
public boolean wonGame;
+ private int containerUpdateDelay; // Paper
// CraftBukkit start
public String displayName;
@@ -591,7 +592,12 @@ public class ServerPlayer extends Player {
--this.invulnerableTime;
}
- this.containerMenu.broadcastChanges();
+ // Paper start - Configurable container update tick rate
+ if (--containerUpdateDelay <= 0) {
+ this.containerMenu.broadcastChanges();
+ containerUpdateDelay = level.paperConfig.containerUpdateTickRate;
+ }
+ // Paper end
if (!this.level.isClientSide && !this.containerMenu.stillValid(this)) {
this.closeContainer();
this.containerMenu = this.inventoryMenu;