Feature/mars rock layers (#1519)

* moving to real tfc rock layers!

* thanks git

* git pls

* that's a good start for the mars rock layer stuff now

* langs, some desert block height tweaks

* mars water fog color

* forgot to convert back from hex to dec
This commit is contained in:
Pyritie 2025-08-04 11:22:18 +01:00 committed by GitHub
parent e978f798f7
commit 084c99db07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 829 additions and 1975 deletions

View file

@ -1,6 +1,10 @@
// priority: 0
"use strict";
const $HeightMap = Java.loadClass("net.minecraft.world.level.levelgen.Heightmap")
const ROCK_LAYER_HEIGHT = 40;
TFCEvents.createChunkDataProvider('mars', event => {
const rain = TFC.misc.lerpFloatLayer(0, 0, 0, 0);
@ -14,15 +18,14 @@ TFCEvents.createChunkDataProvider('mars', event => {
.affine(6, 12)
.scaled(6, 18, 0, 1)
// Precompute the surface & aquifer heights as constants as this is nether and does not realistically change
let heights = [];
const rockNoise = TFC.misc.newOpenSimplex2D(event.worldSeed + 8008135)
.octaves(3)
.scaled(0x80000000, 0x7fffffff) // Integer.MIN_VALUE to Integer.MAX_VALUE
.spread(0.00001) // spread it out so the vaiance is small
// Precompute the aquifer heights as constants as this is not used
var aquifer = [];
let i = 0;
while (i < 256) {
heights.push(127);
i++;
}
let aquifer = [];
i = 0;
while (i < 16) {
aquifer.push(32);
i++;
@ -49,10 +52,16 @@ TFCEvents.createChunkDataProvider('mars', event => {
});
event.full((data, chunk) => {
let heights = [];
for (let z = 0; z < 16; z++) {
for (let x = 0; x < 16; x++) {
heights[x + 16 * z] = chunk.getHeight($HeightMap.Types.OCEAN_FLOOR_WG, x, z);
}
}
data.generateFull(heights, aquifer);
});
event.rocks((x, y, z, surfaceY, cache, rockLayers) => {
return rockLayers.sampleAtLayer(0, 0);
return rockLayers.sampleAtLayer(rockNoise.noise(x, z), (surfaceY - y) / ROCK_LAYER_HEIGHT);
});
})