3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/patches/server/0042-Configurable-container-update-tick-rate.patch

47 Zeilen
2.1 KiB
Diff

2021-06-11 14:02:28 +02:00
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 fcbb0d6cd09a9c80a8725c9cf0c503fa0532f1e3..156059d4951fa01b10cc36d70cd439037c636e4c 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -237,4 +237,9 @@ public class PaperWorldConfig {
2021-06-11 14:02:28 +02:00
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
2022-06-07 21:15:06 +02:00
index cebd22696a672fc0f1c1fb0676ac76842244b6d3..a375d2d0bffc3694e76bae3f9ba13f60e629d859 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
2022-06-07 21:15:06 +02:00
@@ -226,6 +226,7 @@ public class ServerPlayer extends Player {
2021-06-12 02:57:04 +02:00
private int containerCounter;
2021-06-11 14:02:28 +02:00
public int latency;
public boolean wonGame;
+ private int containerUpdateDelay; // Paper
// CraftBukkit start
public String displayName;
2022-06-07 21:15:06 +02:00
@@ -598,7 +599,12 @@ public class ServerPlayer extends Player {
2021-06-11 14:02:28 +02:00
--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;