Skip to content

Commit

Permalink
Restructured rook outpost to make use of MSPlacedFeatures and MSPlace…
Browse files Browse the repository at this point in the history
…dFeatureProvider
  • Loading branch information
Dweblenod committed May 19, 2024
1 parent f4bf7d1 commit 7baf3c6
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,7 @@
[],
[],
[
{
"feature": {
"type": "minestuck:rook_outpost",
"config": {}
},
"placement": [
{
"type": "minecraft:rarity_filter",
"chance": 120
},
{
"type": "minecraft:heightmap",
"heightmap": "OCEAN_FLOOR"
},
{
"type": "minecraft:random_offset",
"xz_spread": 0,
"y_spread": -4
}
]
}
"minestuck:rook_outpost"
]
],
"has_precipitation": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "minestuck:rook_outpost",
"config": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"feature": "minestuck:rook_outpost",
"placement": [
{
"type": "minecraft:rarity_filter",
"chance": 128
},
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:heightmap",
"heightmap": "OCEAN_FLOOR"
},
{
"type": "minecraft:random_offset",
"xz_spread": 0,
"y_spread": -4
},
{
"type": "minecraft:biome"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,33 @@

import com.mraof.minestuck.entity.MSEntityTypes;
import com.mraof.minestuck.world.biome.MSBiomes;
import com.mraof.minestuck.world.gen.feature.MSFeatures;
import net.minecraft.core.Holder;
import com.mraof.minestuck.world.gen.feature.MSPlacedFeatures;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.data.worldgen.placement.PlacementUtils;
import net.minecraft.util.valueproviders.ConstantInt;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeGenerationSettings;
import net.minecraft.world.level.biome.BiomeSpecialEffects;
import net.minecraft.world.level.biome.MobSpawnSettings;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.minecraft.world.level.levelgen.placement.RandomOffsetPlacement;
import net.minecraft.world.level.levelgen.placement.RarityFilter;

import java.util.List;

public final class MSBiomeProvider
{
public static void register(BootstapContext<Biome> context)
{
context.register(MSBiomes.SKAIA, skaiaBiome());
HolderGetter<PlacedFeature> features = context.lookup(Registries.PLACED_FEATURE);

context.register(MSBiomes.SKAIA, skaiaBiome(features));

MSBiomes.DEFAULT_LAND.createForDataGen(context);
MSBiomes.HIGH_HUMID_LAND.createForDataGen(context);
MSBiomes.NO_RAIN_LAND.createForDataGen(context);
MSBiomes.SNOW_LAND.createForDataGen(context);
}

private static Biome skaiaBiome()
private static Biome skaiaBiome(HolderGetter<PlacedFeature> features)
{
MobSpawnSettings.Builder spawnInfo = new MobSpawnSettings.Builder();
spawnInfo.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(MSEntityTypes.DERSITE_PAWN.get(), 2, 1, 10));
Expand All @@ -48,8 +43,7 @@ private static Biome skaiaBiome()
BiomeSpecialEffects.Builder ambience = new BiomeSpecialEffects.Builder().waterColor(0x3F76E4).waterFogColor(0x050533);
ambience.fogColor(0xCDCDFF).skyColor(0x7AA4FF);

genSettings.addFeature(GenerationStep.Decoration.SURFACE_STRUCTURES, Holder.direct(new PlacedFeature(Holder.direct(new ConfiguredFeature<>(MSFeatures.ROOK_OUTPOST.get(), FeatureConfiguration.NONE)),
List.of(RarityFilter.onAverageOnceEvery(120), PlacementUtils.HEIGHTMAP_OCEAN_FLOOR, RandomOffsetPlacement.vertical(ConstantInt.of(-4))))));
genSettings.addFeature(GenerationStep.Decoration.SURFACE_STRUCTURES, features.getOrThrow(MSPlacedFeatures.ROOK_OUTPOST));

return new Biome.BiomeBuilder().hasPrecipitation(false).temperature(0.5F).downfall(0.5F).specialEffects(ambience.build()).mobSpawnSettings(spawnInfo.build()).generationSettings(genSettings.build()).build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public static void register(BootstapContext<ConfiguredFeature<?, ?>> context)

context.register(RETURN_NODE, new ConfiguredFeature<>(MSFeatures.RETURN_NODE.get(), FeatureConfiguration.NONE));

context.register(ROOK_OUTPOST, new ConfiguredFeature<>(MSFeatures.ROOK_OUTPOST.get(), FeatureConfiguration.NONE));

var smallCog = context.register(SMALL_COG, new ConfiguredFeature<>(MSFeatures.SIMPLE_TEMPLATE.get(),
new SimpleTemplateFeature.Config(Minestuck.id("small_cog"), true,
SimpleTemplateFeature.HeightQueryType.MIN.with(Heightmap.Types.WORLD_SURFACE_WG, UniformInt.of(-2, 0)))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public static void register(BootstapContext<PlacedFeature> context)
context.register(RETURN_NODE, placed(features, MSCFeatures.RETURN_NODE,
worldGenModifiers(RarityFilter.onAverageOnceEvery(128), PlacementUtils.HEIGHTMAP)));

context.register(ROOK_OUTPOST, placed(features, MSCFeatures.ROOK_OUTPOST,
worldGenModifiers(RarityFilter.onAverageOnceEvery(128), PlacementUtils.HEIGHTMAP_OCEAN_FLOOR, RandomOffsetPlacement.vertical(ConstantInt.of(-4)))));

context.register(COG, placed(features, MSCFeatures.COG,
worldGenModifiers(RarityFilter.onAverageOnceEvery(2))));
context.register(UNCOMMON_COG, placed(features, MSCFeatures.COG,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public final class MSCFeatures
{
public static final ResourceKey<ConfiguredFeature<?, ?>> RETURN_NODE = key("return_node");

public static final ResourceKey<ConfiguredFeature<?, ?>> ROOK_OUTPOST = key("rook_outpost");

public static final ResourceKey<ConfiguredFeature<?, ?>> SMALL_COG = key("small_cog");
public static final ResourceKey<ConfiguredFeature<?, ?>> LARGE_COG_1 = key("large_cog_1");
public static final ResourceKey<ConfiguredFeature<?, ?>> LARGE_COG_2 = key("large_cog_2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public final class MSFeatures

public static final Supplier<Feature<NoneFeatureConfiguration>> RETURN_NODE = REGISTER.register("return_node", () -> new ReturnNodeFeature(NoneFeatureConfiguration.CODEC));

public static final Supplier<Feature<NoneFeatureConfiguration>> ROOK_OUTPOST = REGISTER.register("rook_outpost", () -> new RookOutpostFeature(NoneFeatureConfiguration.CODEC));

public static final Supplier<Feature<SimpleTemplateFeature.Config>> SIMPLE_TEMPLATE = REGISTER.register("simple_template", () -> new SimpleTemplateFeature(SimpleTemplateFeature.Config.CODEC));

public static final Supplier<Feature<NoneFeatureConfiguration>> FLOOR_COG = REGISTER.register("floor_cog", () -> new FloorCogFeature(NoneFeatureConfiguration.CODEC));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public final class MSPlacedFeatures
{
public static final ResourceKey<PlacedFeature> RETURN_NODE = key("return_node");

public static final ResourceKey<PlacedFeature> ROOK_OUTPOST = key("rook_outpost");

public static final ResourceKey<PlacedFeature> COG = key("cog/regular");
public static final ResourceKey<PlacedFeature> UNCOMMON_COG = key("cog/sparse");
public static final ResourceKey<PlacedFeature> FLOOR_COG = key("cog/floor_regular");
Expand Down

0 comments on commit 7baf3c6

Please sign in to comment.