mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-07-02 17:44:42 +02:00
c09ee99f7e
Closes #257 Ports 2 patches from Purpur: Infinity-bow-settings & Allow-infinite-and-mending-enchantments-together Added an option for infinity with no arrows too. Option for custom locale has come! You can put a locale.json file in your server folder to change it. We've got the finest patches from Hydrinity ( Mykyta approved & allowed ) too. We have some amazing new options in yatopia.yml, we're gonna have documentation for them soon so stay tuned! Last but not least, chunk generation patches. We've tested them extensively so no weirdness happens. Thanks for using Yatopia as your production server software. Co-authored-by: Ivan Pekov <ivan@mrivanplays.com>
113 lines
3.6 KiB
Diff
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) {
|