mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-28 03:19:22 +00:00
Update Paper
This commit is contained in:
45
patches/server/0102-Optimized-CubePointRange.patch
Normal file
45
patches/server/0102-Optimized-CubePointRange.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Thu, 20 Jul 2023 20:22:47 +0800
|
||||
Subject: [PATCH] Optimized CubePointRange
|
||||
|
||||
This patch is Powered by Gale(https://github.com/GaleMC/Gale)
|
||||
|
||||
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..81d18ce2ee4342b466c6623bcad7840c929eb79d 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java
|
||||
@@ -3,21 +3,31 @@ package net.minecraft.world.phys.shapes;
|
||||
import it.unimi.dsi.fastutil.doubles.AbstractDoubleList;
|
||||
|
||||
public class CubePointRange extends AbstractDoubleList {
|
||||
+ private final int size; // Leaves - replace parts by size in CubePointRange
|
||||
private final int parts;
|
||||
+ private final double scale; // Leaves - replace division by multiplication in CubePointRange
|
||||
|
||||
CubePointRange(int sectionCount) {
|
||||
if (sectionCount <= 0) {
|
||||
throw new IllegalArgumentException("Need at least 1 part");
|
||||
} else {
|
||||
this.parts = sectionCount;
|
||||
+ this.size = sectionCount + 1;
|
||||
}
|
||||
+ this.scale = 1.0D / sectionCount; // Leaves - replace division by multiplication in CubePointRange
|
||||
}
|
||||
|
||||
public double getDouble(int i) {
|
||||
- return (double)i / (double)this.parts;
|
||||
+ // Leaves start - replace division by multiplication in CubePointRange
|
||||
+ if (!top.leavesmc.leaves.LeavesConfig.optimizedCubePointRange) {
|
||||
+ return (double)i / (double)this.parts;
|
||||
+ } else {
|
||||
+ return i * this.scale;
|
||||
+ }
|
||||
+ // Leaves start - replace division by multiplication in CubePointRange
|
||||
}
|
||||
|
||||
public int size() {
|
||||
- return this.parts + 1;
|
||||
+ return !top.leavesmc.leaves.LeavesConfig.optimizedCubePointRange ? this.parts + 1 : size; // Leaves - replace parts by size in CubePointRange
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user