55 lines
2.3 KiB
Java
55 lines
2.3 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* org.jspecify.annotations.Nullable
|
|
*/
|
|
package net.minecraft.client.gui.components.debug;
|
|
|
|
import java.util.ArrayList;
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.client.gui.components.debug.DebugScreenDisplayer;
|
|
import net.minecraft.client.gui.components.debug.DebugScreenEntry;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.resources.Identifier;
|
|
import net.minecraft.server.level.ServerChunkCache;
|
|
import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.level.Level;
|
|
import net.minecraft.world.level.biome.BiomeSource;
|
|
import net.minecraft.world.level.biome.Climate;
|
|
import net.minecraft.world.level.chunk.ChunkGenerator;
|
|
import net.minecraft.world.level.chunk.LevelChunk;
|
|
import net.minecraft.world.level.levelgen.RandomState;
|
|
import org.jspecify.annotations.Nullable;
|
|
|
|
public class DebugEntryChunkGeneration
|
|
implements DebugScreenEntry {
|
|
private static final Identifier GROUP = Identifier.withDefaultNamespace("chunk_generation");
|
|
|
|
@Override
|
|
public void display(DebugScreenDisplayer displayer, @Nullable Level serverOrClientLevel, @Nullable LevelChunk clientChunk, @Nullable LevelChunk serverChunk) {
|
|
ServerLevel serverLevel;
|
|
Minecraft minecraft = Minecraft.getInstance();
|
|
Entity entity = minecraft.getCameraEntity();
|
|
ServerLevel serverLevel2 = serverLevel = serverOrClientLevel instanceof ServerLevel ? (ServerLevel)serverOrClientLevel : null;
|
|
if (entity == null || serverLevel == null) {
|
|
return;
|
|
}
|
|
BlockPos feetPos = entity.blockPosition();
|
|
ServerChunkCache chunkSource = serverLevel.getChunkSource();
|
|
ArrayList<String> result = new ArrayList<String>();
|
|
ChunkGenerator generator = chunkSource.getGenerator();
|
|
RandomState randomState = chunkSource.randomState();
|
|
generator.addDebugScreenInfo(result, randomState, feetPos);
|
|
Climate.Sampler sampler = randomState.sampler();
|
|
BiomeSource biomeSource = generator.getBiomeSource();
|
|
biomeSource.addDebugInfo(result, feetPos, sampler);
|
|
if (serverChunk != null && serverChunk.isOldNoiseGeneration()) {
|
|
result.add("Blending: Old");
|
|
}
|
|
displayer.addToGroup(GROUP, result);
|
|
}
|
|
}
|
|
|