mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-20 07:19:31 +00:00
Use platform math functions
This commit is contained in:
@@ -1,77 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Date: Wed, 23 Nov 2022 22:53:39 +0100
|
||||
Subject: [PATCH] Remove streams and iterators from range check
|
||||
|
||||
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:
|
||||
"Remove streams and iterators from range check"
|
||||
By: Paul Sauve <paul@technove.co>
|
||||
As part of: Airplane (https://github.com/TECHNOVE/Airplane)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
* Airplane copyright *
|
||||
|
||||
Airplane
|
||||
Copyright (C) 2020 Technove LLC
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 31963a0931bcd3465e46b9c875e89ac56aead62d..caa765c6264e14cc66973267f94074c7056fe122 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1549,8 +1549,30 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return ChunkMap.this.level.getServer().getScaledTrackingDistance(initialDistance);
|
||||
}
|
||||
|
||||
+ // Gale start - Airplane - remove streams and iterators from range check
|
||||
+ private static int getHighestRange(Entity parent, int highest) {
|
||||
+ List<Entity> passengers = parent.getPassengers();
|
||||
+
|
||||
+ for (int i = 0, size = passengers.size(); i < size; i++) {
|
||||
+ Entity entity = passengers.get(i);
|
||||
+ int range = entity.getType().clientTrackingRange() * 16;
|
||||
+ range = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, range); // Paper
|
||||
+
|
||||
+ if (range > highest) { // Paper - we need the lowest range thanks to the fact that our tracker doesn't account for passenger logic // Tuinity - not anymore!
|
||||
+ highest = range;
|
||||
+ }
|
||||
+
|
||||
+ highest = getHighestRange(entity, highest);
|
||||
+ }
|
||||
+
|
||||
+ return highest;
|
||||
+ }
|
||||
+ // Gale end - Airplane - remove streams and iterators from range check
|
||||
+
|
||||
private int getEffectiveRange() {
|
||||
int i = this.range;
|
||||
+ // Gale start - Airplane - remove streams and iterators from range check
|
||||
+ /*
|
||||
Iterator iterator = this.entity.getIndirectPassengers().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -1562,6 +1584,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
+ */
|
||||
+ i = getHighestRange(this.entity, i);
|
||||
+ // Gale end - Airplane - remove streams and iterators from range check
|
||||
|
||||
return this.scaledRange(i);
|
||||
}
|
||||
Reference in New Issue
Block a user