From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Sudzzy 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 --- 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 { 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 cebd22696a672fc0f1c1fb0676ac76842244b6d3..a375d2d0bffc3694e76bae3f9ba13f60e629d859 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -226,6 +226,7 @@ public class ServerPlayer extends Player { private int containerCounter; public int latency; public boolean wonGame; + private int containerUpdateDelay; // Paper // CraftBukkit start public String displayName; @@ -598,7 +599,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;