Skip to content

Commit

Permalink
thing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mysticpasta1 committed Apr 25, 2023
1 parent ace015e commit 2c74dae
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.mystic.eclipse.lighting;

import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.chunk.ChunkProvider;
import net.minecraft.world.chunk.light.ChunkSkyLightProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,18 @@
import com.mystic.eclipse.utils.noise.FastNoiseLite;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.fluid.Fluids;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.random.Random;
import net.minecraft.util.math.random.RandomSplitter;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.world.HeightLimitView;
import net.minecraft.world.Heightmap;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.biome.source.BiomeAccess;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.gen.HeightContext;
import net.minecraft.world.gen.chunk.BlockColumn;
import net.minecraft.world.gen.chunk.ChunkNoiseSampler;
import net.minecraft.world.gen.densityfunction.DensityFunction;
import net.minecraft.world.gen.noise.NoiseConfig;
import net.minecraft.world.gen.noise.NoiseRouter;
import net.minecraft.world.gen.surfacebuilder.MaterialRules;
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;

Expand Down Expand Up @@ -114,45 +106,42 @@ public String toString() {
for(int l = 0; l < 16; ++l) {
int m = i + k;
int n = j + l;
int o = chunk.sampleHeightmap(Heightmap.Type.WORLD_SURFACE_WG, k, l) + 1;
mutable.setX(m).setZ(n);

int p = chunk.sampleHeightmap(Heightmap.Type.WORLD_SURFACE_WG, k, l) + 1;
int r = Integer.MIN_VALUE;
int t = chunk.getBottomY();

for(int u = p; u >= t; --u) {
for (int u = 320; u >= t; --u) {
BlockState blockState = blockColumn.getState(u);
if (blockState.isAir()) {
r = Integer.MIN_VALUE;
} else if (!blockState.getFluidState().isEmpty()) {
}

if (!blockState.getFluidState().isEmpty()) {
if (r == Integer.MIN_VALUE) {
r = u + 1;
}
} else {
FastNoiseLite noiseLite = new FastNoiseLite();
int scaledNoise = (int) (noiseLite.GetNoise(k, u, l) / 3.0D + 3.0D + random.split(k, u, l).nextDouble() * 0.25D);
if (blockColumn.getState(u) != Blocks.BEDROCK.getDefaultState()) {
// -1 depth means we are switching from air to solid land. Place the surface block now
if (o <= scaledNoise) {
// The typical normal dry surface of the biome.
if (o >= u - 1) {
chunk.setBlockState(mutable, getTopMaterial(chunk), false);
}
// Places middle block when starting to go under sealevel.
// Think of this as the top block of the bottom of shallow lakes in your biome.
else if (o >= u - 7) {
chunk.setBlockState(mutable, getMidMaterial(chunk), false);
}
// Places the underwater block when really deep under sealevel instead.
// This is like the top block of the sea floor.
else {
chunk.setBlockState(mutable, getBottomMaterial(chunk), false);
}
} else {
chunk.setBlockState(mutable, getBottomMaterial(chunk), false);
}
}
}
if (r == Integer.MIN_VALUE) {
r = u;
}

FastNoiseLite noiseLite = new FastNoiseLite();
int xRan = Math.round(((float) random.split(k, chunkNoiseSampler.blockY() - 3, l).nextGaussian() * 3.0f) + 7);
int zRan = Math.round(((float) random.split(k, chunkNoiseSampler.blockY() - 3, l).nextGaussian() * 3.0f) + 7);
int scaledNoise = Math.round(
((noiseLite.GetNoise(chunkPos.getBlockPos(k, 0, l).getX() + chunkNoiseSampler.blockX() + (xRan / 4.0f), chunkNoiseSampler.blockY() - 3, chunkPos.getBlockPos(k, 0, l).getZ() + chunkNoiseSampler.blockZ() + (zRan / 4.0f) * 3) + 7) *
((noiseLite.GetNoise(chunkPos.getBlockPos(k, 0, l).getX() + chunkNoiseSampler.blockX() + (xRan / 4.0f), chunkNoiseSampler.blockY() - 3, chunkPos.getBlockPos(k, 0, l).getZ() + chunkNoiseSampler.blockZ() + (zRan / 4.0f)) * 3) + 7)
));

if (r == (80 + scaledNoise) - 1) {
chunk.setBlockState(mutable, getTopMaterial(chunk), false);
} else if (r >= (80 + scaledNoise) - 7 && r < (80 + scaledNoise) - 1) {
chunk.setBlockState(mutable, getMidMaterial(chunk), false);
} else if (r >= -59 + scaledNoise && r < 80 + scaledNoise - 7) {
chunk.setBlockState(mutable, getBottomMaterial(chunk), false);
} else if (r < -59 + scaledNoise) {
chunk.setBlockState(mutable, Blocks.BEDROCK.getDefaultState(), false);
}
}
}
Expand Down
14 changes: 0 additions & 14 deletions src/main/resources/eclipse.accesswidener
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
accessWidener v1 named
accessible field net/minecraft/world/gen/StructureAccessor world Lnet/minecraft/world/WorldAccess;
extendable method net/minecraft/client/world/GeneratorType <init> (Ljava/lang/String;)V
accessible method net/minecraft/world/gen/chunk/ChunkGeneratorSettings <init> (Lnet/minecraft/world/gen/chunk/StructuresConfig;Lnet/minecraft/world/gen/chunk/GenerationShapeConfig;Lnet/minecraft/block/BlockState;Lnet/minecraft/block/BlockState;IIIIZZZZZZ)V
accessible field net/minecraft/world/gen/chunk/NoiseChunkGenerator horizontalNoiseResolution I
accessible field net/minecraft/world/gen/chunk/NoiseChunkGenerator verticalNoiseResolution I
accessible field net/minecraft/world/gen/chunk/NoiseChunkGenerator noiseColumnSampler Lnet/minecraft/world/gen/NoiseColumnSampler;
accessible field net/minecraft/world/gen/NoiseColumnSampler biomeSource Lnet/minecraft/world/biome/source/BiomeSource;
accessible field net/minecraft/world/gen/NoiseColumnSampler topSlideSize D
accessible field net/minecraft/world/gen/NoiseColumnSampler topSlideOffset D
accessible field net/minecraft/world/gen/NoiseColumnSampler topSlideTarget D
accessible field net/minecraft/world/gen/NoiseColumnSampler bottomSlideSize D
accessible field net/minecraft/world/gen/NoiseColumnSampler bottomSlideOffset D
accessible field net/minecraft/world/gen/NoiseColumnSampler bottomSlideTarget D
accessible field net/minecraft/world/gen/chunk/NoiseChunkGenerator settings Ljava/util/function/Supplier;
accessible method net/minecraft/world/chunk/light/ChunkLightProvider getStateForLighting (JLorg/apache/commons/lang3/mutable/MutableInt;)Lnet/minecraft/block/BlockState;
accessible method net/minecraft/world/chunk/light/ChunkLightProvider getOpaqueShape (Lnet/minecraft/block/BlockState;JLnet/minecraft/util/math/Direction;)Lnet/minecraft/util/shape/VoxelShape;
accessible class net/minecraft/world/chunk/light/SkyLightStorage$Data
Expand All @@ -23,7 +10,6 @@ accessible field net/minecraft/world/chunk/light/LightStorage chunkProvider Lnet
extendable class net/minecraft/world/chunk/light/ChunkSkyLightProvider
accessible method net/minecraft/world/chunk/light/LightStorage hasSection (J)Z
accessible method net/minecraft/world/gen/chunk/ChunkNoiseSampler sampleBlockState ()Lnet/minecraft/block/BlockState;
accessible method net/minecraft/world/chunk/light/SkyLightStorage method_31931 (JZ)I
accessible method net/minecraft/world/chunk/light/LightStorage updateAll ()V
accessible method net/minecraft/world/chunk/light/SkyLightStorage isAtOrAboveTopmostSection (J)Z
accessible method net/minecraft/world/chunk/light/SkyLightStorage isAboveMinHeight (I)Z
Expand Down

0 comments on commit 2c74dae

Please sign in to comment.