mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-19 14:59:29 +00:00
37 lines
1.6 KiB
Diff
37 lines
1.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Wed, 23 Nov 2022 23:32:51 +0100
|
|
Subject: [PATCH] Optimize entity coordinate key
|
|
|
|
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:
|
|
"Optimize entity coordinate key"
|
|
By: Kevin Raneri <kevin.raneri@gmail.com>
|
|
As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish)
|
|
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
|
|
* Pufferfish description *
|
|
|
|
When executing getCoordinateKey for entities (a hotpath), the JVM is
|
|
required to repeatedly cast doubles to longs. The performance impact of
|
|
this depends on the CPU architecture, but generally switching between
|
|
FPU and ALU incurs a significant performance hit. The casted/rounded
|
|
data is already available in the blockPosition struct, so we use that
|
|
instead of re-doing the casting.
|
|
|
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
index 72da610c4d0301ddf2940bbc067430d05ff46684..0bbac68dbd891da8892ba40fc18578c4f9e67c11 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -225,7 +225,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
public double yo;
|
|
public double zo;
|
|
private Vec3 position;
|
|
- private BlockPos blockPosition;
|
|
+ public BlockPos blockPosition; // Gale - Pufferfish - optimize entity coordinate key - private -> public
|
|
private ChunkPos chunkPosition;
|
|
private Vec3 deltaMovement = Vec3.ZERO;
|
|
private float yRot;
|