mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-28 19:39:17 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@30fdfb1a [ci/skip] Fix docs for DamageResistant (#11992) PaperMC/Paper@6b7650d8 Only add goat horn once (#12001) PaperMC/Paper@30046e04 Fix a rare crash with a concurrent modification of scaled health attributes (#12002) PaperMC/Paper@88bbead1 Flush regionfiles on save configuration option PaperMC/Paper@336ea9df Check for empty when sending equipment changes (#12008) PaperMC/Paper@939bb782 Add RayTraceConfigurationBuilder (#11907) PaperMC/Paper@81bb82f5 Fix wrong piston world border check (#12007) PaperMC/Paper@ce95b5d6 Use proper default for setting null display background color (#12010) PaperMC/Paper@2477f1f6 [ci/skip] fix and improvements for docs in ConsumeEffect component (#11998) PaperMC/Paper@fb5b173c Add PlayerClientLoadedWorldEvent (#11940) PaperMC/Paper@3af5e771 Add Player#give (#11995) PaperMC/Paper@7e21cb81 fix PlayerChangedMainHandEvent javadoc (#12020) PaperMC/Paper@5a34bf04 Correctly retrun true for empty input shapes in EntityGetter#isUnobstructed PaperMC/Paper@a392d475 Make Watchdog thread extend TickThread Gale Changes: Dreeam-qwq/Gale@f9080a7e Updated Upstream (Paper) Dreeam-qwq/Gale@ff0596c1 [ci/skip] Fix upstream commit sh on mac Dreeam-qwq/Gale@24970274 [ci/skip] Hermanez - Wutaf Dreeam-qwq/Gale@85eabf60 [ci/skip] cleanup Dreeam-qwq/Gale@7d9faf00 [ci/skip] cleanup & drop xor-shift random Dreeam-qwq/Gale@7af04981 [ci/skip] cleanup Dreeam-qwq/Gale@4d5d39df [ci/skip] Remove useless params standardize in upstream commit generator Dreeam-qwq/Gale@964f16ff Updated Upstream (Paper) Dreeam-qwq/Gale@0566a223 [ci/skip] cleanup Dreeam-qwq/Gale@5e3f6740 [ci/skip] cleanup work finished Dreeam-qwq/Gale@98a66cfb Updated Upstream (Paper) Dreeam-qwq/Gale@f7736578 [ci/skip] Update upstreamCommit.sh Dreeam-qwq/Gale@1c46c816 Updated Upstream (Paper) Dreeam-qwq/Gale@2b0a4c09 [ci/skip] Skip tests during auto update validate phase Purpur Changes: PurpurMC/Purpur@4a0a86b9 Updated Upstream (Paper) PurpurMC/Purpur@7399988c Fix hover in /plugins PurpurMC/Purpur@5e5857dc [ci/skip] modify ci skip references in paper upstream commits PurpurMC/Purpur@5583a3f1 Updated Upstream (Paper)
73 lines
3.6 KiB
Diff
73 lines
3.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
|
|
Date: Tue, 9 Nov 2077 00:00:00 +0800
|
|
Subject: [PATCH] C2ME: Optimize world gen math
|
|
|
|
This patch is based on following mixins:
|
|
* "com/ishland/c2me/opts/math/mixin/MixinChunkPos.java"
|
|
* "com/ishland/c2me/opts/worldgen/vanilla/mixin/aquifer/MixinNoiseChunkGenerator.java"
|
|
By: ishland <ishlandmc@yeah.net>
|
|
As part of: C2ME-fabric (https://github.com/RelativityMC/C2ME-fabric)
|
|
Licensed under: MIT
|
|
|
|
Co-authored-by: Taiyou06 <kaandindar21@gmail.com>
|
|
|
|
diff --git a/net/minecraft/world/level/ChunkPos.java b/net/minecraft/world/level/ChunkPos.java
|
|
index 55ce935a2fab7e32904d9ff599867269035d703f..6e2b2d258e47dcca30a5ad9f4f492598f2bc21fb 100644
|
|
--- a/net/minecraft/world/level/ChunkPos.java
|
|
+++ b/net/minecraft/world/level/ChunkPos.java
|
|
@@ -110,7 +110,13 @@ public class ChunkPos {
|
|
|
|
@Override
|
|
public boolean equals(Object other) {
|
|
- return this == other || other instanceof ChunkPos chunkPos && this.x == chunkPos.x && this.z == chunkPos.z;
|
|
+ // Leaf start - C2ME - Optimize world gen math
|
|
+ // Use standard equals
|
|
+ if (other == this) return true;
|
|
+ if (other == null || other.getClass() != this.getClass()) return false;
|
|
+ ChunkPos thatPos = (ChunkPos) other;
|
|
+ return this.x == thatPos.x && this.z == thatPos.z;
|
|
+ // Leaf end - C2ME - Optimize world gen math
|
|
}
|
|
|
|
public int getMiddleBlockX() {
|
|
diff --git a/net/minecraft/world/level/levelgen/Beardifier.java b/net/minecraft/world/level/levelgen/Beardifier.java
|
|
index 131923282c9ecbcb1d7f45a826da907c02bd2716..47b6519f40ed978c05d93023a0cdc1c9e13f033f 100644
|
|
--- a/net/minecraft/world/level/levelgen/Beardifier.java
|
|
+++ b/net/minecraft/world/level/levelgen/Beardifier.java
|
|
@@ -132,8 +132,15 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
|
|
}
|
|
|
|
private static double getBuryContribution(double x, double y, double z) {
|
|
- double len = Mth.length(x, y, z);
|
|
- return Mth.clampedMap(len, 0.0, 6.0, 1.0, 0.0);
|
|
+ // Leaf start - C2ME - Optimize world gen math
|
|
+ // Optimize method for beardifier
|
|
+ double len = Math.sqrt(x * x + y * y + z * z);
|
|
+ if (len > 6.0) {
|
|
+ return 0.0;
|
|
+ } else {
|
|
+ return 1.0 - len / 6.0;
|
|
+ }
|
|
+ // Leaf end - C2ME - Optimize world gen math
|
|
}
|
|
|
|
private static double getBeardContribution(int x, int y, int z, int height) {
|
|
diff --git a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
|
index 57ae4aaf1431021daf77c5638038d4910a358155..d4317668df3b1a2ae1b6091b65dfa9da3582f967 100644
|
|
--- a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
|
+++ b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
|
@@ -68,8 +68,10 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
|
Aquifer.FluidStatus fluidStatus = new Aquifer.FluidStatus(-54, Blocks.LAVA.defaultBlockState());
|
|
int seaLevel = settings.seaLevel();
|
|
Aquifer.FluidStatus fluidStatus1 = new Aquifer.FluidStatus(seaLevel, settings.defaultFluid());
|
|
- Aquifer.FluidStatus fluidStatus2 = new Aquifer.FluidStatus(DimensionType.MIN_Y * 2, Blocks.AIR.defaultBlockState());
|
|
- return (x, y, z) -> y < Math.min(-54, seaLevel) ? fluidStatus : fluidStatus1;
|
|
+ // Leaf start - C2ME - Optimize world gen math
|
|
+ final int min = Math.min(-54, seaLevel);
|
|
+ return (x, y, z) -> y < min ? fluidStatus : fluidStatus1;
|
|
+ // Leaf end - C2ME - Optimize world gen math
|
|
}
|
|
|
|
@Override
|