Yatopia/patches/server/0052-lithium-VoronoiBiomeAccessTypeMixin.patch
Ivan Pekov adb131f051
Updated Upstream and Sidestream(s) (Tuinity/EMC/Purpur/AirplaneLite)
Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Tuinity Changes:
2325c36 Updated Upstream (Paper)

EMC Changes:
a841b5a5 Fix more lore/item name issues (fixes witch gem issue)
1abb3fae Ensure server conversions on ExactChoice ingredients
f2f9d2b0 Forgot to commit paper ref
388620d5 Updated Paper
7a0ae67b Add a null check for UUID to prevent npe later
9de409e0 Updated Paper
0d09eb9a Add new Empire Server API for managing fake players for the tablist

Purpur Changes:
da95725 Updated Upstream (Tuinity)
7194a16 Updated Upstream (Paper)
77373ea Updated Upstream (Tuinity)
0bae78d Drop async advancements patch for now

AirplaneLite Changes:
7b4acbe h != k
a07e80c Whoops, missed paperclip change
845c191 Add license to patch files
fa671b7 Allow gradle wrapper in gitignore
04fc820 Rework strip raytracing patch
f48f6b2 Updated Upstream (Tuinity)
ec7c6df Fix encoding
9326301 Update upstream, fix utf8
20b8c79 Allow gradle wrapper in gitignore
6cd80e9 Updated Upstream (Tuinity)
2021-01-03 13:41:36 +02:00

113 lines
3.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JellySquid <jellysquid+atwork@protonmail.com>
Date: Sat, 26 Sep 2020 15:45:09 -0500
Subject: [PATCH] lithium VoronoiBiomeAccessTypeMixin
Original code by JellySquid, licensed under LGPLv3
you can find the original code on https://github.com/jellysquid3/lithium-fabric/ (Yarn mappings)
diff --git a/src/main/java/net/minecraft/server/GenLayerZoomVoronoi.java b/src/main/java/net/minecraft/server/GenLayerZoomVoronoi.java
index 70ea171edc419f8614004b6e50fc34b8fd9b4a20..47415b738c83541f76d504ad4d5f619ccd023feb 100644
--- a/src/main/java/net/minecraft/server/GenLayerZoomVoronoi.java
+++ b/src/main/java/net/minecraft/server/GenLayerZoomVoronoi.java
@@ -8,6 +8,8 @@ public enum GenLayerZoomVoronoi implements GenLayerZoomer {
@Override
public BiomeBase a(long i, int j, int k, int l, BiomeManager.Provider biomemanager_provider) {
+ // Yatopia start - replaced logic
+ /*
int i1 = j - 2;
int j1 = k - 2;
int k1 = l - 2;
@@ -54,6 +56,75 @@ public enum GenLayerZoomVoronoi implements GenLayerZoomer {
l2 = (k2 & 2) == 0 ? i2 : i2 + 1;
i3 = (k2 & 1) == 0 ? j2 : j2 + 1;
return biomemanager_provider.getBiome(k3, l2, i3);
+ */
+ int x1 = j - 2;
+ int y1 = k - 2;
+ int z1 = l - 2;
+
+ int x2 = x1 >> 2;
+ int y2 = y1 >> 2;
+ int z2 = z1 >> 2;
+
+ double x3 = (double) (x1 & 3) / 4.0D;
+ double y3 = (double) (y1 & 3) / 4.0D;
+ double z3 = (double) (z1 & 3) / 4.0D;
+
+ int retX = Integer.MIN_VALUE;
+ int retY = Integer.MIN_VALUE;
+ int retZ = Integer.MIN_VALUE;
+
+ // This code would normally allocate an array to store each iteration's results, then scan back over it
+ // to determine the closest one. We can avoid the unnecessary step and simply keep track of the nearest one.
+ double minDist = Double.POSITIVE_INFINITY;
+
+ for (int i1 = 0; i1 < 8; i1++) {
+ // Block sample positions
+ int bX;
+ int bY;
+ int bZ;
+
+ // Sample positions
+ double sX;
+ double sY;
+ double sZ;
+
+ if ((i1 & 0b100) == 0) {
+ bX = x2;
+ sX = x3;
+ } else {
+ bX = x2 + 1;
+ sX = x3 - 1.0D;
+ }
+
+ if ((i1 & 0b010) == 0) {
+ bY = y2;
+ sY = y3;
+ } else {
+ bY = y2 + 1;
+ sY = y3 - 1.0D;
+ }
+
+ if ((i1 & 0b001) == 0) {
+ bZ = z2;
+ sZ = z3;
+ } else {
+ bZ = z2 + 1;
+ sZ = z3 - 1.0D;
+ }
+
+ double dist = a(i, bX, bY, bZ, sX, sY, sZ);
+
+ if (minDist > dist) {
+ minDist = dist;
+
+ retX = bX;
+ retY = bY;
+ retZ = bZ;
+ }
+ }
+
+ return biomemanager_provider.getBiome(retX, retY, retZ);
+ // Yatopia end
}
private static double a(long i, int j, int k, int l, double d0, double d1, double d2) {
@@ -76,9 +147,14 @@ public enum GenLayerZoomVoronoi implements GenLayerZoomer {
}
private static double a(long i) {
+ // Yatopia start - replaced logic
+ /*
double d0 = (double) ((int) Math.floorMod(i >> 24, 1024L)) / 1024.0D;
return (d0 - 0.5D) * 0.9D;
+ */
+ return (((i >> 24) & 1023L) - 512) * 0.00087890625; // * 0.9 / 1024.0d
+ // Yatopia end
}
private static double a(double d0) {