mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-24 01:09:27 +00:00
Faster floating-point positive modulo
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Date: Fri, 23 Dec 2022 20:42:50 +0100
|
||||
Subject: [PATCH] Reduce block destruction packet allocations
|
||||
|
||||
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
Gale - https://galemc.org
|
||||
|
||||
This patch is based on the following patch:
|
||||
"Cache block break animation packet"
|
||||
By: VytskaLT <VytskaLT@protonmail.com>
|
||||
As part of: SportPaper (https://github.com/Electroid/SportPaper)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 9879599c38db4f3332c347b6b0c26034bc7749bc..1462f9d4f2cdf4071fb002d602783866a5a3d285 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1695,7 +1695,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
@Override
|
||||
public void destroyBlockProgress(int entityId, BlockPos pos, int progress) {
|
||||
- Iterator iterator = this.server.getPlayerList().getPlayers().iterator();
|
||||
+
|
||||
+ // Gale start - SportPaper - reduce block destruction packet allocations
|
||||
+ var players = this.server.getPlayerList().getPlayers();
|
||||
+ if (players.isEmpty()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ ClientboundBlockDestructionPacket packet = new ClientboundBlockDestructionPacket(entityId, pos, progress);
|
||||
+
|
||||
+ Iterator iterator = players.iterator();
|
||||
+ // Gale end - SportPaper - reduce block destruction packet allocations
|
||||
|
||||
// CraftBukkit start
|
||||
Player entityhuman = null;
|
||||
@@ -1718,7 +1728,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
// CraftBukkit end
|
||||
|
||||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
- entityplayer.connection.send(new ClientboundBlockDestructionPacket(entityId, pos, progress));
|
||||
+ entityplayer.connection.send(packet); // Gale - SportPaper - reduce block destruction packet allocations
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user