9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-22 16:29:26 +00:00
Files
Gale/patches/server/0075-Replace-division-by-multiplication-in-CubePointRange.patch
2022-12-01 14:14:53 +01:00

39 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MartijnMuijsers <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)
This patch is based on the following mixin:
"me/jellysquid/mods/lithium/mixin/shapes/precompute_shape_arrays/FractionalDoubleListMixin.java"
By: 2No2Name <2No2Name@web.de>
As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
diff --git a/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java b/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java
index a544db042c8d2ecec8d323770552c4f10ca758a6..e7bffb7f757dbeac255676823de6464329f2f535 100644
--- a/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java
+++ b/src/main/java/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
CubePointRange(int sectionCount) {
if (sectionCount <= 0) {
@@ -11,10 +12,11 @@ public class CubePointRange extends AbstractDoubleList {
} else {
this.parts = sectionCount;
}
+ this.scale = 1.0D / sectionCount; // Gale - Lithium - replace division by multiplication in CubePointRange
}
public double getDouble(int i) {
- return (double)i / (double)this.parts;
+ return i * this.scale; // Gale - Lithium - replace division by multiplication in CubePointRange
}
public int size() {