Yatopia/patches/server/0044-lithium-PerlinNoiseSamplerMixin.patch
Simon Gardling 99a93cf526
upstream (#421)
* Updated Upstream and Sidestream(s) (Paper/Tuinity/Purpur/Airplane/Empirecraft/Origami)

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.

Paper Changes:
d23f8b62e fix? #5222
0f2575de2 fix? #5222
7c3499702 fix? #5218
c8eec830b fix #5217
a235c77ce Adventure 4.5.0
511cd52f0 fix #5214
33d4f608b fix stupid legacy chat garbage
a1eebfea9 fix #5212 and #5213
466820160 Upstream Update (#5211)
2a0ee4b65 Add support for hex color codes in console
4e958e229 We're going on an Adventure! (#4842)
1a9735611 Stop loop when flags set to false (#5101)
a5928db4a [Auto] Updated Upstream (CraftBukkit)
5fd19303f Call PreCreatureSpawnEvent for more spawn reasons (#5201)

Tuinity Changes:
2f298d3 Fix getEntities for ender dragon parts

Purpur Changes:
55af107 Updated Upstream (Paper)
8369588 Updated Upstream (Paper & Tuinity)
14906a1 Allow for removing italics from items renamed in the anvil by starting the text with '&r'
f599c59 Update silk touch spawners patch to use adventure
e17ee14 Update anvil colors patch to use adventure
b538cd9 Updated Upstream (Paper)
c08f028 Updated Upstream (Tuinity)
90f67f8 Updated Upstream (Paper)
c98cc6b Configs for if Wither/Ender Dragon can ride vehicles
2d2e1d4 Fix Wither and Ender Dragon being able to ride boats when they cannot in Paper/Vanilla

Airplane Changes:
3fc432c [skip ci] Add Patrons section
4b9dd63 Skip POI finding if stuck in vehicle
1ba97ae Updated Upstream (Tuinity)

Empirecraft Changes:
58dee2db Updated Paper
48c1161a Updated Paper

Origami Changes:
654b344 Only try to update below hopper if non-ticking is enabled

* Updated Upstream and Sidestream(s) (Paper)

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.

Paper Changes:
d5cb9308f fix #5224

* it works, finally

* I think everything is fixed now....

* Updated Upstream and Sidestream(s) (Paper/Tuinity/Purpur/Airplane/Empirecraft)

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.

Paper Changes:
2dd5dccf0 Add config option for displayname in quit message (#5260)
63fe5e4b7 Fix further issues with rgb text pattern matching
89be8185d Don't grab the threads stacktrace when dumping same thread
ca4c781d8 [Auto] Updated Upstream (Bukkit/CraftBukkit)
6ae212125 Display name should never be null
bf2f8aeaf Add @NotNull to Key in org.bukkit.sound (#5241)
01f9b65f9 Sound can implement Adventure's Sound.Type
aa282a1a0 Don't try to deserialize a null string in legacy method
9bcd08cb3 [CI-SKIP] [Auto] Rebuild Patches
ea6fd6076 [Auto] Updated Upstream (Bukkit)
d9b02e94d Misc thread dumps (#5200)
a0093e142 Adventure 4.5.1
afea0e8ab Add links to the Adventure javadocs
846783c8a Fix a couple of typos in the javadoc for Player (#5235)
a2574d8f5 Replace usages of LegacyComponentSerializer.legacySection() in Paper-Server with PaperAdventure.LEGACY_SECTION_UXRC (#5233)
cae142b85 Enable Hex colors on PaperAdventure.LEGACY_SECTION_UXRC, and use it for sending messages to console command sender (#5230)
c1635eabb PlayerDeathEvent#getDeathMessage should provide translation for legacy reasons #5227
3f74af202 Fix Log4J converter not parsing hex without named colors (#5228)

Tuinity Changes:
7734ef0 Detail player ticking in watchdog dumps

Purpur Changes:
529c260 [ci-skip] Update Gradle to 6.8.3
831b8d7 Updated Upstream (Paper)
d3c8fb2 Updated Upstream (Paper)
4602b9b Updated Upstream (Paper)
18f97a9 Make fox breeding cooldown work, add villager breeding cooldown config
868c9ca Updated Upstream (Paper)
274c7b2 Updated Upstream (Paper)

Airplane Changes:
9f3cad3 Updated Upstream (Tuinity)

Empirecraft Changes:
3e3e8e5e Updated Paper

* Updated Upstream and Sidestream(s) (Paper/Purpur/Empirecraft)

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.

Paper Changes:
df4c68b66 fix #5279 - clickable links again
ff5ff3af4 Print command usage for /paper entity list at more places (#5282)
5d779a621 Implements PlayerHandshakeEvent#getOriginalSocketAddressHostname and deprecates PlayerHandshakeEvent(String, boolean) in favour of PlayerHandshakeEvent(String, String, boolean)
6fab1ee3a Expose Tracked Players
b53a650a5 Clear SyncLoadInfo
c02c22fde fix: legacy component serialisation was wiped out

Purpur Changes:
a5fa038 Updated Upstream (Paper)

Empirecraft Changes:
95ac7f87 Updated Paper

* Updated Upstream and Sidestream(s) (Paper)

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.

Paper Changes:
06900aef5 Fix username connecting with no texture being overwritten by usercache (#4970)

* Updated Upstream and Sidestream(s) (Paper/Purpur)

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.

Paper Changes:
9907cedec New chat events for better Adventure support (#5289)

Purpur Changes:
34f0e57 Updated Upstream (Paper)

* Updated Upstream and Sidestream(s) (Paper/Purpur/Paper)

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.

Paper Changes:
9907cedec New chat events for better Adventure support (#5289)

Purpur Changes:
34f0e57 Updated Upstream (Paper)

Paper Changes:
60e92c061 fix #5292 with help from @JRoy

* that doesn't need to be there

* Updated Upstream and Sidestream(s) (Paper/Purpur/Airplane)

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.

Paper Changes:
7d56f38ed Do not use the bukkit singleton for the GUI (Fixes #5301)
4c9bdf53a Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5299)
8647bd130 Improve ServerGUI
fcc6d3359 Throw proper exception on empty JsonList file
17d2e1291 Fix interact event in adventure mode
964e0bf42 MC-29274: Fix Wither hostility towards players
9e24a5213 Fixed furnace cook-speed multiplier losing precision when calculating cook time
c7e42faa3 Do not create unnecessary copies of the passenger list
40881ad67 added tnt minecarts to the tnt height nerf
26be708f4 Remove streams from SensorNearest
5b5989b21 fix nullability of playerlist header/footer, closes #5290
45bc531dd Fix Material#getTranslationKey for Block Materials (#5294)

Purpur Changes:
68ff99e Updated Upstream (Paper)

Airplane Changes:
80d65be Add more licenses
4d27e5b Use our own bstats, move mcdev fixes

* whoops

* Updated Upstream and Sidestream(s) (Airplane)

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.

Airplane Changes:
d50d4e1 Rewrite disabling of POI searching when stuck

* Updated Upstream and Sidestream(s) (Paper)

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.

Paper Changes:
be1687914 stop firing pressure plate EntityInteractEvent for ignored entities (fixes #4962)

* Updated Upstream and Sidestream(s) (Paper/Paper)

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.

Paper Changes:
be1687914 stop firing pressure plate EntityInteractEvent for ignored entities (fixes #4962)

Paper Changes:
aaef1d5cc fix file conversion
674d8f7f7 Make discovered maps config work in treasure maps from loot tables too

* Updated Upstream and Sidestream(s) (Paper)

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.

Paper Changes:
616b1f3cd consider enchants for destroy speed

* Updated Upstream and Sidestream(s) (Paper/Purpur/Airplane)

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.

Paper Changes:
5b20df6bf added PlayerNameEntityEvent
ff9c82444 Add worldborder events

Purpur Changes:
d93887a Updated Upstream (Paper)

Airplane Changes:
02743da Complete /airplane command
a2be422 Add /airplane command
3b90baf [SKIP-CI] Use patreon for sponsor button

* Updated Upstream and Sidestream(s) (Paper/Tuinity/Purpur)

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.

Paper Changes:
be7cde2c7 [CI-SKIP] Always check PATH for JDK (#5315)

Tuinity Changes:
09e1a10 Fix NPE in light exception handler
0ae7c2c Dump even more info for ticking entities
2e4a930 Store changed positions inside field on light engine

Purpur Changes:
c54e65f Add config for snow on blue ice
2fdd7d4 One Punch Man! (#185)
c2bd3de Dont run with scissors (#184)

* Updated Upstream and Sidestream(s) (Paper)

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.

Paper Changes:
54ec85949 Prevent grindstones from overstacking items
d7795080c Fix NPE for AIR in meta operations in ItemStack
2e70796c7 [CI-SKIP] Improve documentation of PreCreatureSpawnEvent (#5244)
7bb92e750 [CI-SKIP] Add JavaDoc links to Tag class pointing to custom Paper tags (#5285)
28cd686bf fix per-world difficulty command (#5306)

* Updated Upstream and Sidestream(s) (Tuinity/Airplane/Akarin/Empirecraft)

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:
71b089f Do not run raytrace logic for AIR

Airplane Changes:
815b461 Flare

Akarin Changes:
62342de Update README.md
dfcbbf5 Update SUPPORT.md
4225fcf Updated Tuinity's Paper
3950fd5 Updated build badge
f2d367c Merge branch 'ver/1.15.2' into ver/1.16.4

Empirecraft Changes:
3718e178 Updated Paper

* whoops

* Updated Upstream and Sidestream(s) (Tuinity)

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:
f87cb79 Make entity tracker use highest range of passengers

* Updated Upstream and Sidestream(s) (Airplane)

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.

Airplane Changes:
dd6a75c Updated Upstream (Tuinity)
48ff3e0 Some tweaks to increase Flare's compatibility

* Updated Upstream and Sidestream(s) (Airplane/Airplane)

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.

Airplane Changes:
dd6a75c Updated Upstream (Tuinity)
48ff3e0 Some tweaks to increase Flare's compatibility

Airplane Changes:
e7fc41a Update to latest version of Flare

* Updated Upstream and Sidestream(s) (Airplane)

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.

Airplane Changes:
86781ec Multithreaded Tracker!

* Updated Upstream and Sidestream(s) (Paper)

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.

Paper Changes:
7f72c4675 Use implementation-provided legacy serializer for events
27a8d99ec Adventure 4.7.0
e65bd35a1 Respect teams in legacy chat name if configured (#5321)
b31089a92 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5325)
a52b30814 Fix title swapping fadeIn and stay

* Updated Upstream and Sidestream(s) (Paper)

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.

Paper Changes:
e4d8a6279 Implement Keyed on World
bcb63dab7 [CI-SKIP] [Auto] Rebuild Patches
48342b06c Allow signs that are inside of the spawn protection to be right clicked to use their run_command tag
c229f90c1 Add Block#isValidTool
20e709c1d Add recipe to cook events
2dcf8bff4 legacy formatting will be the death of me
f597fea0d legacy formatting is worse than walking around in wet socks

* Updated Upstream and Sidestream(s) (Paper/Purpur)

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.

Paper Changes:
e4d8a6279 Implement Keyed on World
bcb63dab7 [CI-SKIP] [Auto] Rebuild Patches
48342b06c Allow signs that are inside of the spawn protection to be right clicked to use their run_command tag
c229f90c1 Add Block#isValidTool
20e709c1d Add recipe to cook events
2dcf8bff4 legacy formatting will be the death of me
f597fea0d legacy formatting is worse than walking around in wet socks

Purpur Changes:
63c370c One Punch Man 2: Electric Boogaloo (#187)
2021-03-09 15:11:49 -06:00

183 lines
6.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JellySquid <jellysquid+atwork@protonmail.com>
Date: Sat, 26 Sep 2020 11:37:25 -0500
Subject: [PATCH] lithium PerlinNoiseSamplerMixin
This is a more optimized version of Lithium's PerlinNoiseSamplerMixin.
Original code by JellySquid, licensed under LGPLv3
you can find the original code on https://github.com/CaffeineMC/lithium-fabric/ (Yarn mappings)
Co-authored-by: Bud Gidiere <sgidiere@gmail.com>
diff --git a/src/main/java/net/minecraft/server/NoiseGeneratorPerlin.java b/src/main/java/net/minecraft/server/NoiseGeneratorPerlin.java
index d7ca619b228e2a5a461085e0c5222e6a36a66fe0..ea157542df2617eec6b5a62331e1daa3c086ffae 100644
--- a/src/main/java/net/minecraft/server/NoiseGeneratorPerlin.java
+++ b/src/main/java/net/minecraft/server/NoiseGeneratorPerlin.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import java.util.Random;
+import org.apache.commons.math3.util.FastMath; // Yatopia
public final class NoiseGeneratorPerlin {
@@ -8,6 +9,12 @@ public final class NoiseGeneratorPerlin {
public final double a;
public final double b;
public final double c;
+ // Yatopia start - Faster Perlin
+ private static final int GRADIENT_STRIDE = 4;
+ private static final int GRADIENT_STRIDE_SH = 2;
+
+ private final byte[] gradientTable = new byte[256 * GRADIENT_STRIDE];
+ // Yatopia end
public NoiseGeneratorPerlin(Random random) {
this.a = random.nextDouble() * 256.0D;
@@ -29,8 +36,19 @@ public final class NoiseGeneratorPerlin {
this.d[i + j] = b0;
}
+ // Yatopia start
+ for (i = 0; i < 256; i++) {
+ int hash = this.d[i & 255] & 15;
+
+ for (int j = 0; j < 3; j++) {
+ this.gradientTable[(i * GRADIENT_STRIDE) + j] = (byte) NoiseGenerator3Handler.a[hash][j];
+ }
+ }
+ // Yatopia end
}
+ // Yatopia start - replaced logic
+ /*
public double a(double d0, double d1, double d2, double d3, double d4) {
double d5 = d0 + this.a;
double d6 = d1 + this.b;
@@ -55,6 +73,125 @@ public final class NoiseGeneratorPerlin {
}
return this.a(i, j, k, d8, d9 - d14, d10, d11, d12, d13);
+ */
+ public final double sample(double x, double y, double z, double d, double e) { return a(x, y, z, d, e); } // Yatopia - OBFHELPER
+ public final double a(double x, double y, double z, double d, double e) {
+ final double ox = x + this.a;
+ final double oy = y + this.b;
+ final double oz = z + this.c;
+
+ final double fox = FastMath.floor(ox);
+ final double foy = FastMath.floor(oy);
+ final double foz = FastMath.floor(oz);
+
+ final double oox = ox - fox;
+ double ooy = oy - foy;
+ final double ooz = oz - foz;
+
+ final double fx = oox * oox * oox * (oox * (oox * 6.0 - 15.0) + 10.0);
+ final double fy = ooy * ooy * ooy * (ooy * (ooy * 6.0 - 15.0) + 10.0);
+ final double fz = ooz * ooz * ooz * (ooz * (ooz * 6.0 - 15.0) + 10.0);
+
+ if (d != 0.0D) { ooy = ooy - (FastMath.floor(FastMath.min(e, ooy) / d) * d); }
+
+ final int sectionX = (int) fox;
+ final int sectionY = (int) foy;
+ final int sectionZ = (int) foz;
+
+ final byte[] perm = this.d;
+
+ final int i = (perm[sectionX & 255] & 255) + sectionY;
+ final int l = (perm[(sectionX + 1) & 255] & 255) + sectionY;
+
+ final int j = (perm[255 & i] & 255) + sectionZ;
+ final int m = (perm[l & 255] & 255) + sectionZ;
+
+ final int k = (perm[(i + 1) & 255] & 255) + sectionZ;
+ final int n = (perm[(l + 1) & 255] & 255) + sectionZ;
+
+ final double localX2 = oox - 1.0D;
+ final double localY2 = ooy - 1.0D;
+ final double localZ2 = ooz - 1.0D;
+
+ final int d00 = (j & 255) << GRADIENT_STRIDE_SH;
+ final int d01 = (m & 255) << GRADIENT_STRIDE_SH;
+ final int d02 = (k & 255) << GRADIENT_STRIDE_SH;
+ final int d03 = (n & 255) << GRADIENT_STRIDE_SH;
+
+ final int d10 = ((j + 1) & 255) << GRADIENT_STRIDE_SH;
+ final int d11 = ((m + 1) & 255) << GRADIENT_STRIDE_SH;
+ final int d12 = ((k + 1) & 255) << GRADIENT_STRIDE_SH;
+ final int d13 = ((n + 1) & 255) << GRADIENT_STRIDE_SH;
+
+ final byte[] grad = this.gradientTable;
+
+ final double g00x = grad[d00] * oox;
+ final double g00y = grad[d00 + 1] * ooy;
+ final double g00z = grad[d00 + 2] * ooz;
+
+ final double g01x = grad[d01] * localX2;
+ final double g01y = grad[d01 + 1] * ooy;
+ final double g01z = grad[d01 + 2] * ooz;
+
+ final double g02x = grad[d02] * oox;
+ final double g02y = grad[d02 + 1] * localY2;
+ final double g02z = grad[d02 + 2] * ooz;
+
+ final double g03x = grad[d03] * localX2;
+ final double g03y = grad[d03 + 1] * localY2;
+ final double g03z = grad[d03 + 2] * ooz;
+
+ final double g10x = grad[d10] * oox;
+ final double g10y = grad[d10 + 1] * ooy;
+ final double g10z = grad[d10 + 2] * localZ2;
+
+ final double g11x = grad[d11] * localX2;
+ final double g11y = grad[d11 + 1] * ooy;
+ final double g11z = grad[d11 + 2] * localZ2;
+
+ final double g12x = grad[d12] * oox;
+ final double g12y = grad[d12 + 1] * localY2;
+ final double g12z = grad[d12 + 2] * localZ2;
+
+ final double g13x = grad[d13] * localX2;
+ final double g13y = grad[d13 + 1] * localY2;
+ final double g13z = grad[d13 + 2] * localZ2;
+
+ final double g00 = g00x + g00y + g00z;
+ final double g01 = g01x + g01y + g01z;
+ final double g02 = g02x + g02y + g02z;
+ final double g03 = g03x + g03y + g03z;
+ final double g10 = g10x + g10y + g10z;
+ final double g11 = g11x + g11y + g11z;
+ final double g12 = g12x + g12y + g12z;
+ final double g13 = g13x + g13y + g13z;
+
+ final double ba1 = g01 - g00;
+ final double ba2 = g11 - g10;
+ final double dc1 = g03 - g02;
+ final double dc2 = g13 - g12;
+
+ final double dba1 = fx * ba1;
+ final double dba2 = fx * ba2;
+ final double ddc1 = fx * dc1;
+ final double ddc2 = fx * dc2;
+
+ final double dd0 = g00 + dba1;
+ final double dd1 = g10 + dba2;
+ final double dd2 = g02 + ddc1;
+ final double dd3 = g12 + ddc2;
+
+ final double aa0 = dd2 - dd0;
+ final double aa1 = dd3 - dd1;
+
+ final double y20 = fy * aa0;
+ final double y31 = fy * aa1;
+
+ final double aa2 = dd0 + y20;
+ final double aa3 = dd1 + y31;
+
+ return dd0 + y20 + (fz * (aa3 - aa2));
+ // Yatopia end
}
private static double a(int i, double d0, double d1, double d2) {