Skip to content

Commit

Permalink
继续写维度...
Browse files Browse the repository at this point in the history
  • Loading branch information
Cjsah committed Jan 23, 2022
1 parent 5ca075c commit e5a1092
Show file tree
Hide file tree
Showing 21 changed files with 120 additions and 289 deletions.
3 changes: 3 additions & 0 deletions src/generated/resources/.cache/cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
08e56a0290a7b2bcb59afbb499abe59edef73925 data/ironstars/dimension/moon.json
a0bb608ed4bc527c91941856da1791896ec1c016 data/ironstars/dimension_type/moon_type.json
64dab7c693513ddd3c9e48c4f485ec5076fd8944 data/ironstars/worldgen/noise_settings/moon_noise_config.json
14 changes: 14 additions & 0 deletions src/generated/resources/data/ironstars/dimension/moon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"type": "ironstars:moon_type",
"generator": {
"wrapped_generator": {
"biome_source": {
"type": "ironstars:ironstars_biomes"
},
"seed": 0,
"settings": "ironstars:moon_noise_config",
"type": "minecraft:noise"
},
"type": "ironstars:structure_locating_wrapper"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"logical_height": 256,
"infiniburn": "minecraft:infiniburn_overworld",
"effects": "minecraft:the_end",
"ambient_light": 0.0,
"respawn_anchor_works": true,
"has_raids": false,
"min_y": 0,
"height": 256,
"natural": false,
"coordinate_scale": 1.0,
"piglin_safe": true,
"bed_works": false,
"has_skylight": true,
"has_ceiling": false,
"ultrawarm": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"ore_veins_enabled": false,
"noodle_caves_enabled": false,
"legacy_random_source": false,
"disable_mob_generation": false,
"aquifers_enabled": false,
"noise_caves_enabled": false,
"default_fluid": {
"Properties": {
"level": "0"
},
"Name": "minecraft:water"
},
"surface_rule": {
"sequence": [
{
"if_true": {
"random_name": "minecraft:bedrock_floor",
"true_at_and_below": {
"above_bottom": 0
},
"false_at_and_above": {
"above_bottom": 5
},
"type": "minecraft:vertical_gradient"
},
"then_run": {
"result_state": {
"Name": "minecraft:bedrock"
},
"type": "minecraft:block"
},
"type": "minecraft:condition"
},
{
"if_true": {
"type": "minecraft:above_preliminary_surface"
},
"then_run": {
"result_state": {
"Name": "ironstars:moon_soil"
},
"type": "minecraft:block"
},
"type": "minecraft:condition"
}
],
"type": "minecraft:sequence"
},
"sea_level": 0,
"structures": {
"structures": {}
},
"noise": {
"terrain_shaper": {
"offset": 0.0,
"factor": 0.0,
"jaggedness": 0.0
},
"size_horizontal": 1,
"size_vertical": 1,
"sampling": {
"xz_scale": 1.0,
"y_scale": 1.0,
"xz_factor": 80.0,
"y_factor": 160.0
},
"top_slide": {
"target": -10.0,
"size": 3,
"offset": 0
},
"bottom_slide": {
"target": 15.0,
"size": 3,
"offset": 0
},
"min_y": 0,
"height": 256
},
"default_block": {
"Name": "ironstars:moon_rock"
}
}
5 changes: 0 additions & 5 deletions src/main/java/com/xekr/ironstars/world/Area.java

This file was deleted.

5 changes: 0 additions & 5 deletions src/main/java/com/xekr/ironstars/world/AreaFactory.java

This file was deleted.

12 changes: 0 additions & 12 deletions src/main/java/com/xekr/ironstars/world/AreaTransformer0.java

This file was deleted.

30 changes: 0 additions & 30 deletions src/main/java/com/xekr/ironstars/world/BigContext.java

This file was deleted.

46 changes: 2 additions & 44 deletions src/main/java/com/xekr/ironstars/world/BiomeProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.google.common.collect.ImmutableList;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.xekr.ironstars.registry.AllBiomes;
import com.xekr.ironstars.registry.AllDimensions;
import net.minecraft.core.Registry;
import net.minecraft.data.worldgen.biome.OverworldBiomes;
import net.minecraft.resources.RegistryLookupCodec;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.biome.Biome;
Expand All @@ -15,7 +15,6 @@

import java.util.List;
import java.util.Optional;
import java.util.function.LongFunction;

public class BiomeProvider extends BiomeSource {
public static final Codec<BiomeProvider> CODEC = RecordCodecBuilder.create((instance) -> instance.group(
Expand All @@ -26,60 +25,19 @@ public class BiomeProvider extends BiomeSource {
private static final List<ResourceKey<Biome>> BIOMES = ImmutableList.of(Biomes.DESERT);

private final Registry<Biome> registry;
private final Layer genBiomes;
private final long seed;

public BiomeProvider(long seed, Registry<Biome> registryIn) {
super(BIOMES.stream().map(ResourceKey::location).map(registryIn::getOptional).filter(Optional::isPresent).map(opt -> opt::get));
this.seed = seed;
registry = registryIn;
genBiomes = makeLayers(seed, registryIn);

}

public static int getBiomeId(ResourceKey<Biome> biome, Registry<Biome> registry) {
return registry.getId(registry.get(biome));
}

private static <T extends Area, C extends BigContext<T>> AreaFactory<T> makeLayers(LongFunction<C> seed, Registry<Biome> registry, long rawSeed) {

AreaFactory<T> biomes = GenLayerTFBiomes.INSTANCE.setup(registry).run(seed.apply(1L));
// biomes = GenLayerTFKeyBiomes.INSTANCE.setup(registry, rawSeed).run(seed.apply(1000L), biomes);
// biomes = GenLayerTFCompanionBiomes.INSTANCE.setup(registry).run(seed.apply(1000L), biomes);
//
// biomes = ZoomLayer.NORMAL.run(seed.apply(1000L), biomes);
// biomes = ZoomLayer.NORMAL.run(seed.apply(1001L), biomes);
//
// biomes = GenLayerTFBiomeStabilize.INSTANCE.run(seed.apply(700L), biomes);
//
// biomes = GenLayerTFThornBorder.INSTANCE.setup(registry).run(seed.apply(500L), biomes);
//
// biomes = ZoomLayer.NORMAL.run(seed.apply(1002), biomes);
// biomes = ZoomLayer.NORMAL.run(seed.apply(1003), biomes);
// biomes = ZoomLayer.NORMAL.run(seed.apply(1004), biomes);
// biomes = ZoomLayer.NORMAL.run(seed.apply(1005), biomes);
//
// AreaFactory<T> riverLayer = GenLayerTFStream.INSTANCE.setup(registry).run(seed.apply(1L), biomes);
// riverLayer = SmoothLayer.INSTANCE.run(seed.apply(7000L), riverLayer);
// biomes = GenLayerTFRiverMix.INSTANCE.setup(registry).run(seed.apply(100L), biomes, riverLayer);

return biomes;
}

public static Layer makeLayers(long seed, Registry<Biome> registry) {
AreaFactory<LazyArea> areaFactory = makeLayers((context) -> new LazyAreaContext(25, seed, context), registry, seed);
return new Layer(areaFactory) {
@Override
public Biome get(Registry<Biome> p_242936_1_, int p_242936_2_, int p_242936_3_) {
int i = this.area.get(p_242936_2_, p_242936_3_);
Biome biome = registry.byId(i);
if (biome == null)
throw new IllegalStateException("Unknown biome id emitted by layers: " + i);
return biome;
}
};
}

@Override
protected Codec<? extends BiomeSource> codec() {
return CODEC;
Expand All @@ -92,6 +50,6 @@ public BiomeSource withSeed(long pSeed) {

@Override
public Biome getNoiseBiome(int p_186735_, int p_186736_, int p_186737_, Climate.Sampler p_186738_) {
return genBiomes.get(registry, p_186735_, p_186737_);
return OverworldBiomes.desert();
}
}
9 changes: 0 additions & 9 deletions src/main/java/com/xekr/ironstars/world/Context.java

This file was deleted.

51 changes: 0 additions & 51 deletions src/main/java/com/xekr/ironstars/world/GenLayerTFBiomes.java

This file was deleted.

26 changes: 0 additions & 26 deletions src/main/java/com/xekr/ironstars/world/Layer.java

This file was deleted.

Loading

0 comments on commit e5a1092

Please sign in to comment.