9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-06 15:51:31 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0054-Replace-division-by-multiplication-in-CubePointRange.patch
Dreeam 3b162fb788 Move Purpur patches to first
To reduce the difficulty on maintenance and reduce chances to fix conflicts on updating
2025-10-01 18:27:42 -04:00

41 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Wed, 30 Nov 2022 17:24:24 +0100
Subject: [PATCH] Replace division by multiplication in CubePointRange
License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
Gale - https://galemc.org
This patch is based on the following mixin:
"net/caffeinemc/mods/lithium/mixin/shapes/precompute_shape_arrays/CubePointRangeMixin.java"
By: 2No2Name <2No2Name@web.de>
As part of: Lithium (https://github.com/CaffeineMC/lithium)
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
diff --git a/net/minecraft/world/phys/shapes/CubePointRange.java b/net/minecraft/world/phys/shapes/CubePointRange.java
index 62aea61c5f240aa59b8489dd0bbb3d1b69b54b1c..513adb0e75fb70d26f6056d22fe2be30b1a39296 100644
--- a/net/minecraft/world/phys/shapes/CubePointRange.java
+++ b/net/minecraft/world/phys/shapes/CubePointRange.java
@@ -4,6 +4,7 @@ import it.unimi.dsi.fastutil.doubles.AbstractDoubleList;
public class CubePointRange extends AbstractDoubleList {
private final int parts;
+ private final double scale; // Gale - Lithium - replace division by multiplication in CubePointRange
public CubePointRange(int parts) {
if (parts <= 0) {
@@ -11,11 +12,12 @@ public class CubePointRange extends AbstractDoubleList {
} else {
this.parts = parts;
}
+ this.scale = 1.0D / parts; // Gale - Lithium - replace division by multiplication in CubePointRange
}
@Override
public double getDouble(int value) {
- return (double)value / this.parts;
+ return value * this.scale; // Gale - Lithium - replace division by multiplication in CubePointRange
}
@Override