mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 00:15:35 +00:00
profile more things
This commit is contained in:
parent
a0c5631eba
commit
205499220d
@ -50,7 +50,6 @@ public class DefaultChunkGenerator3D implements TerraChunkGenerator {
|
||||
|
||||
private final Carver carver;
|
||||
|
||||
|
||||
public DefaultChunkGenerator3D(ConfigPack c, TerraPlugin main) {
|
||||
this.configPack = c;
|
||||
this.main = main;
|
||||
@ -227,17 +226,20 @@ public class DefaultChunkGenerator3D implements TerraChunkGenerator {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"try"})
|
||||
static void biomes(@NotNull World world, int chunkX, int chunkZ, @NotNull BiomeGrid biome, TerraPlugin main) {
|
||||
int xOrig = (chunkX << 4);
|
||||
int zOrig = (chunkZ << 4);
|
||||
BiomeProvider grid = main.getWorld(world).getBiomeProvider();
|
||||
for(int x = 0; x < 4; x++) {
|
||||
for(int z = 0; z < 4; z++) {
|
||||
int cx = xOrig + (x << 2);
|
||||
int cz = zOrig + (z << 2);
|
||||
TerraBiome b = grid.getBiome(cx, cz);
|
||||
try(ProfileFrame ignore = main.getProfiler().profile("biomes")) {
|
||||
int xOrig = (chunkX << 4);
|
||||
int zOrig = (chunkZ << 4);
|
||||
BiomeProvider grid = main.getWorld(world).getBiomeProvider();
|
||||
for(int x = 0; x < 4; x++) {
|
||||
for(int z = 0; z < 4; z++) {
|
||||
int cx = xOrig + (x << 2);
|
||||
int cz = zOrig + (z << 2);
|
||||
TerraBiome b = grid.getBiome(cx, cz);
|
||||
|
||||
biome.setBiome(cx, cz, b.getVanillaBiomes().get(b.getGenerator(world).getBiomeNoise(), cx, 0, cz));
|
||||
biome.setBiome(cx, cz, b.getVanillaBiomes().get(b.getGenerator(world).getBiomeNoise(), cx, 0, cz));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,6 @@ import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeEffects;
|
||||
import net.minecraft.world.biome.GenerationSettings;
|
||||
import net.minecraft.world.biome.SpawnSettings;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
|
||||
@ -77,7 +76,6 @@ import net.minecraft.world.gen.decorator.Decorator;
|
||||
import net.minecraft.world.gen.decorator.NopeDecoratorConfig;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeatures;
|
||||
import net.minecraft.world.gen.feature.DefaultBiomeFeatures;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.FeatureConfig;
|
||||
import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
|
||||
@ -445,7 +443,7 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
|
||||
private void injectTree(CheckedRegistry<Tree> registry, String id, ConfiguredFeature<?, ?> tree) {
|
||||
try {
|
||||
registry.add(id, new FabricTree(tree));
|
||||
registry.add(id, new FabricTree(tree, id));
|
||||
} catch(DuplicateEntryException ignore) {
|
||||
}
|
||||
}
|
||||
|
@ -17,14 +17,16 @@ import java.util.Random;
|
||||
|
||||
public class FabricTree implements Tree {
|
||||
private final ConfiguredFeature<?, ?> delegate;
|
||||
private final String id;
|
||||
|
||||
public FabricTree(ConfiguredFeature<?, ?> delegate) {
|
||||
public FabricTree(ConfiguredFeature<?, ?> delegate, String id) {
|
||||
this.delegate = delegate;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean plant(Location l, Random r) {
|
||||
try(ProfileFrame ignore = TerraFabricPlugin.getInstance().getProfiler().profile("fabric_tree:" + delegate.toString().toLowerCase(Locale.ROOT))) {
|
||||
try(ProfileFrame ignore = TerraFabricPlugin.getInstance().getProfiler().profile("fabric_tree:" + id.toLowerCase(Locale.ROOT))) {
|
||||
FabricWorldAccess fabricWorldAccess = ((FabricWorldAccess) l.getWorld());
|
||||
ChunkGenerator generatorWrapper = ((FabricChunkGenerator) fabricWorldAccess.getGenerator()).getHandle();
|
||||
return delegate.generate((StructureWorldAccess) fabricWorldAccess.getHandle(), generatorWrapper, r, new BlockPos(l.getBlockX(), l.getBlockY(), l.getBlockZ()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user