Skip to content

Commit

Permalink
Center the grove; add lakes to the enchanted forest; remove features …
Browse files Browse the repository at this point in the history
…near the grove.
  • Loading branch information
Sleepy-Horse committed Oct 14, 2024
1 parent 1c539fa commit 8aa78df
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.1 2024-10-08T23:43:42.760223952 Registries
// 1.21.1 2024-10-14T15:18:32.219312658 Registries
9089ada9ce06fd30adf8b10e50f02233c7d5a76e data/minecraft/twilight/wood_palettes/acacia.json
dca1ef01d0df4e956fd414782de57c25dfddd290 data/minecraft/twilight/wood_palettes/birch.json
01becb45438b7f2bfdc77baba72bc986341510c8 data/minecraft/twilight/wood_palettes/crimson.json
Expand Down Expand Up @@ -118,7 +118,7 @@ cd3724ced610878eed7614232aa3df1c1d501f72 data/twilightforest/worldgen/biome/clea
17c5d64992834cfb5edd94617a56698fbd5328d7 data/twilightforest/worldgen/biome/dark_forest_center.json
afbd0904fbe5fdf5e5dcf4a6657138a379e2ad76 data/twilightforest/worldgen/biome/dense_forest.json
6554f2be9d0faeabfa8a652ddb059fc61367f177 data/twilightforest/worldgen/biome/dense_mushroom_forest.json
680be135ef02fc3425f3d799278c345799c35110 data/twilightforest/worldgen/biome/enchanted_forest.json
455c74918cb6c93ac993806592dee6381a17f0d7 data/twilightforest/worldgen/biome/enchanted_forest.json
0f7add8c82f0867894000c6f3a5db4bc48b9027f data/twilightforest/worldgen/biome/final_plateau.json
16a6c39507c7bfda243d44efebf67c427688aa24 data/twilightforest/worldgen/biome/fire_swamp.json
73e266bb4fc8eaad4094adc4133efc6bf25f6e58 data/twilightforest/worldgen/biome/firefly_forest.json
Expand Down Expand Up @@ -271,7 +271,7 @@ ed07f065cfb7a5086353305b5c8dc01c4e35e82e data/twilightforest/worldgen/placed_fea
53e9eb90d244012f3ccbfba21ee44aa346f2d7a1 data/twilightforest/worldgen/placed_feature/default_fallen_logs.json
8380d1e76bf8dbee27ab7e28c3525d43f3e1ac20 data/twilightforest/worldgen/placed_feature/dense_ferns.json
bb9784d9ccca1f1a47065c00c53e64cd92c26d82 data/twilightforest/worldgen/placed_feature/dense_large_ferns.json
ec0e9277c853fd09876c38c98ffd6b6239b12a1e data/twilightforest/worldgen/placed_feature/dense_water_lake.json
7cee9c2996dac31b077e6479bef3524817b91011 data/twilightforest/worldgen/placed_feature/dense_water_lake.json
77bc97d3a7c316f9a7cef0fc3c687b0a5cf0e14a data/twilightforest/worldgen/placed_feature/druid_hut.json
558fc6fc1afda17c9b52e9864b67dd03a4e6af4c data/twilightforest/worldgen/placed_feature/enchanted_forest_vines.json
0648665b104dc44bac69861cd8d240c941ebc50d data/twilightforest/worldgen/placed_feature/fallen_leaves.json
Expand Down Expand Up @@ -360,7 +360,7 @@ ab9ab413230504cd9f9bb3c899d29183f7a544c3 data/twilightforest/worldgen/structure/
981f279d63889e26d2d3a41f1dd5d82684797006 data/twilightforest/worldgen/structure/medium_hollow_hill.json
aa4567b8171a3bb0d739364aa9e8bb5a5fead921 data/twilightforest/worldgen/structure/mushroom_tower.json
2a51406fdc1088d7de4914189d81c69bf788d77c data/twilightforest/worldgen/structure/naga_courtyard.json
4ff0066540dbb64483260da0b4d60d6e622304b2 data/twilightforest/worldgen/structure/quest_grove.json
ebef5750d9a6a7409d072acc8681ed504a05d160 data/twilightforest/worldgen/structure/quest_grove.json
da563625a31738c46356e6c58c35824f5d98c2c4 data/twilightforest/worldgen/structure/small_hollow_hill.json
2db553ab8a6b2ca93ce23fe0738645cff99e2520 data/twilightforest/worldgen/structure/swamp_hollow_tree.json
c80eb035dafc0e1686ca2cffc235606e90cc189b data/twilightforest/worldgen/structure/troll_cave.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
},
"features": [
[],
[],
[
"twilightforest:dense_water_lake"
],
[],
[],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"placement": [
{
"type": "minecraft:rarity_filter",
"chance": 3
"chance": 4
},
{
"type": "minecraft:in_square"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"allow_biome_surface_decorations": false,
"allow_biome_underground_decorations": true,
"biomes": "#twilightforest:valid_quest_grove_biomes",
"chunk_clearance_radius": 1,
"chunk_clearance_radius": 2,
"spawn_overrides": {
"ambient": {
"bounding_box": "full",
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/twilightforest/init/TFPlacedFeatures.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public static void bootstrap(BootstrapContext<PlacedFeature> context) {
context.register(PLACED_DRUID_HUT, new PlacedFeature(features.getOrThrow(TFConfiguredFeatures.DRUID_HUT), tfFeatureCheckArea(AvoidLandmarkModifier.checkBoth(), 105).build()));
context.register(PLACED_DENSE_FERNS, new PlacedFeature(features.getOrThrow(TFConfiguredFeatures.DENSE_FERNS), ImmutableList.<PlacementModifier>builder().add(PlacementUtils.countExtra(3, 0.5F, 1), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP_WORLD_SURFACE, BiomeFilter.biome()).build()));
context.register(PLACED_DENSE_LARGE_FERNS, new PlacedFeature(features.getOrThrow(TFConfiguredFeatures.DENSE_LARGE_FERNS), ImmutableList.<PlacementModifier>builder().add(CountPlacement.of(2), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP_WORLD_SURFACE, BiomeFilter.biome()).build()));
context.register(PLACED_DENSE_LAKE_WATER, new PlacedFeature(features.getOrThrow(TFConfiguredFeatures.LAKE_WATER), tfFeatureCheckArea(AvoidLandmarkModifier.checkBoth(), 3).build()));
context.register(PLACED_DENSE_LAKE_WATER, new PlacedFeature(features.getOrThrow(TFConfiguredFeatures.LAKE_WATER), tfFeatureCheckArea(AvoidLandmarkModifier.checkBoth(), 4).build()));
context.register(PLACED_GRAVEYARD, new PlacedFeature(features.getOrThrow(TFConfiguredFeatures.GRAVEYARD), tfFeatureCheckArea(AvoidLandmarkModifier.checkSurface(), 70).build()));
context.register(PLACED_BIG_MUSHGLOOM, new PlacedFeature(features.getOrThrow(TFConfiguredFeatures.BIG_MUSHGLOOM), tfFeatureCheckArea(AvoidLandmarkModifier.checkSurface(), 1).build()));
context.register(PLACED_FALLEN_LEAVES, new PlacedFeature(features.getOrThrow(TFConfiguredFeatures.FALLEN_LEAVES), tfFeatureCheckArea(AvoidLandmarkModifier.checkSurface(), 1).build()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package twilightforest.world.components;

import net.minecraft.core.BlockPos;
import net.minecraft.util.Mth;
import net.minecraft.world.level.FoliageColor;
import net.minecraft.world.level.GrassColor;
import net.minecraft.world.level.biome.Biome;
import twilightforest.beans.Component;
import twilightforest.util.ColorUtil;
import twilightforest.util.landmarks.LegacyLandmarkPlacements;
import twilightforest.world.components.structures.type.QuestGroveStructure;

@Component
public class BiomeColorAlgorithms {

public int enchanted(int originalColor, int x, int z) { // TODO
int cx = QuestGroveStructure.findCenterX(x);
int cz = QuestGroveStructure.findCenterZ(z);
BlockPos center = LegacyLandmarkPlacements.getNearestCenterXZ(x / 16, z / 16); // Center is quest grove
int cx = center.getX();
int cz = center.getZ();

int dist = (int) Mth.sqrt((cx - x) * (cx - x) + (cz - z) * (cz - z));
int color = dist * 16;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public QuestGroveStructure(DecorationConfig decorationConfig, boolean centerInCh

@Override
protected StructurePiece getFirstPiece(GenerationContext context, RandomSource random, ChunkPos chunkPos, int x, int y, int z) {
return new QuestGrove(context.structureTemplateManager(), new BlockPos(findCenterX(x) - LENGTH / 2, y + 2, findCenterZ(z) - LENGTH / 2));
return new QuestGrove(context.structureTemplateManager(), new BlockPos(x - LENGTH / 2 + 1, y + 2, z - LENGTH / 2 + 1)); // + 1 offsets to center the structure
}

@Override
Expand All @@ -43,7 +43,7 @@ public StructureType<?> type() {

public static QuestGroveStructure buildStructureConfig(BootstrapContext<Structure> context) {
return new QuestGroveStructure(
new DecorationConfig(1, false, true, true),
new DecorationConfig(2, false, true, true),
true, Optional.of(TFMapDecorations.QUEST_GROVE),
new StructureSettings(
context.lookup(Registries.BIOME).getOrThrow(BiomeTagGenerator.VALID_QUEST_GROVE_BIOMES),
Expand All @@ -53,13 +53,4 @@ public static QuestGroveStructure buildStructureConfig(BootstrapContext<Structur
)
);
}

// center of the biome is at % 256 - 8
public static int findCenterX(int x) {
return 256 * Math.round((x - 8) / 256F) + 8;
}

public static int findCenterZ(int z) {
return 256 * Math.round((z - 8) / 256F) - 8;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static BiomeGenerationSettings.Builder enchantedForestGen(HolderGetter<Pl

biome.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, TFPlacedFeatures.PLACED_DENSE_FERNS);
biome.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, TFPlacedFeatures.PLACED_DENSE_LARGE_FERNS);
// biome.addFeature(GenerationStep.Decoration.LAKES, TFPlacedFeatures.PLACED_DENSE_LAKE_WATER); TODO: remove lakes under the grove
biome.addFeature(GenerationStep.Decoration.LAKES, TFPlacedFeatures.PLACED_DENSE_LAKE_WATER);

biome.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, TFPlacedFeatures.PLACED_FLOWER_PLACER);
commonFeatures(biome);
Expand Down

0 comments on commit 8aa78df

Please sign in to comment.