9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-04 15:41:40 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0273-Lithium-combined-heightmap-update.patch

61 lines
3.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Taiyou06 <kaandindar21@gmail.com>
Date: Wed, 30 Jul 2025 23:18:41 +0200
Subject: [PATCH] Lithium: combined heightmap update
This patch is based on the following mixins:
* "net/caffeinemc/mods/lithium/mixin/world/combined_heightmap_update/LevelChunkMixin"
By: 2No2Name <2No2Name@web.de>
As part of: Lithium (https://github.com/CaffeineMC/lithium)
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
index 629ee839c152217c64ff1fead3d112d4cb06e21f..833684b30214566ba27438a1dfb48fbe9f1e6c67 100644
--- a/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
@@ -425,10 +425,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
}
// Leaf end - optimize random tick
Block block = state.getBlock();
- this.heightmaps.get(Heightmap.Types.MOTION_BLOCKING).update(i, y, i2, state);
- this.heightmaps.get(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES).update(i, y, i2, state);
- this.heightmaps.get(Heightmap.Types.OCEAN_FLOOR).update(i, y, i2, state);
- this.heightmaps.get(Heightmap.Types.WORLD_SURFACE).update(i, y, i2, state);
+ // Leaf start - Lithium - combined heightmap update
+ Heightmap heightmap0 = this.heightmaps.get(Heightmap.Types.MOTION_BLOCKING);
+ Heightmap heightmap1 = this.heightmaps.get(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES);
+ Heightmap heightmap2 = this.heightmaps.get(Heightmap.Types.OCEAN_FLOOR);
+ Heightmap heightmap3 = this.heightmaps.get(Heightmap.Types.WORLD_SURFACE);
+ net.caffeinemc.mods.lithium.common.world.chunk.heightmap.CombinedHeightmapUpdate.updateHeightmaps(heightmap0, heightmap1, heightmap2, heightmap3, this, i, y, i2, state);
+ // Leaf end - Lithium - combined heightmap update
boolean hasOnlyAir1 = section.hasOnlyAir();
if (hasOnlyAir != hasOnlyAir1) {
this.level.getChunkSource().getLightEngine().updateSectionStatus(pos, hasOnlyAir1);
diff --git a/net/minecraft/world/level/levelgen/Heightmap.java b/net/minecraft/world/level/levelgen/Heightmap.java
index f7b8637680e654dc0b3e8850d65081a1c565bb69..0d577548e4019d5914885415d903411b7f3d6ecb 100644
--- a/net/minecraft/world/level/levelgen/Heightmap.java
+++ b/net/minecraft/world/level/levelgen/Heightmap.java
@@ -40,6 +40,12 @@ public class Heightmap {
this.data = new SimpleBitStorage(i, 256);
}
+ // Leaf start - Lithium - combined heightmap update
+ public final Predicate<BlockState> isOpaque() {
+ return this.isOpaque;
+ }
+ // Leaf end - Lithium - combined heightmap update
+
public static void primeHeightmaps(ChunkAccess chunk, Set<Heightmap.Types> types) {
if (!types.isEmpty()) {
int size = types.size();
@@ -119,7 +125,7 @@ public class Heightmap {
return this.data.get(index) + this.chunk.getMinY();
}
- private void setHeight(int x, int z, int value) {
+ public void setHeight(int x, int z, int value) { // Leaf - Lithium - combined heightmap update - private -> public
this.data.set(getIndex(x, z), value - this.chunk.getMinY());
}