Skip to content

Commit b8f3367

Browse files
author
racoonman
committed
fixed structure beardifier bug
1 parent bfe4947 commit b8f3367

32 files changed

+1386
-1419
lines changed

common/src/main/java/raccoonman/reterraforged/client/data/RTFLanguageProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ protected void addTranslations() {
202202
this.add(RTFTranslationKeys.GUI_LABEL_EROSION, "Erosion");
203203
this.add(RTFTranslationKeys.GUI_LABEL_SMOOTHING, "Smoothing");
204204

205-
this.add(RTFTranslationKeys.TERRAIN_FOUND, "The nearest %s is at %s");
205+
this.add(RTFTranslationKeys.TERRAIN_FOUND, "The nearest %s is at %s (%s blocks away)");
206206
this.add(RTFTranslationKeys.TERRAIN_NOT_FOUND, "Could not find a \"%s\" within reasonable distance");
207207
this.add(RTFTranslationKeys.TERRAIN_ARGUMENT_INVALID, "Could not find a terrain type with the name \"%s\"");
208208

Original file line numberDiff line numberDiff line change
@@ -1,64 +1,64 @@
1-
package raccoonman.reterraforged.data;
2-
3-
import java.nio.file.Path;
4-
import java.util.concurrent.CompletableFuture;
5-
6-
import net.minecraft.SharedConstants;
7-
import net.minecraft.core.HolderLookup;
8-
import net.minecraft.core.RegistryAccess;
9-
import net.minecraft.data.DataGenerator;
10-
import net.minecraft.data.DataGenerator.PackGenerator;
11-
import net.minecraft.data.PackOutput;
12-
import net.minecraft.data.metadata.PackMetadataGenerator;
13-
import net.minecraft.network.chat.Component;
14-
import net.minecraft.resources.ResourceLocation;
15-
import raccoonman.reterraforged.client.data.RTFLanguageProvider;
16-
import raccoonman.reterraforged.client.data.RTFTranslationKeys;
17-
import raccoonman.reterraforged.data.preset.settings.Preset;
18-
import raccoonman.reterraforged.data.preset.tags.PresetBiomeTagsProvider;
19-
import raccoonman.reterraforged.data.preset.tags.PresetBlockTagsProvider;
20-
import raccoonman.reterraforged.data.preset.tags.PresetSurfaceLayerTags;
21-
import raccoonman.reterraforged.platform.DataGenUtil;
22-
23-
public class RTFDataGen {
24-
public static final String DATAPACK_PATH = "data/reterraforged/datapacks";
25-
26-
public static void generateResourcePacks(ResourcePackFactory resourcePackFactory) {
27-
DataGenerator.PackGenerator pack = resourcePackFactory.createPack();
28-
29-
pack.addProvider(RTFLanguageProvider.EnglishUS::new);
30-
pack.addProvider((PackOutput output) -> PackMetadataGenerator.forFeaturePack(output, Component.translatable(RTFTranslationKeys.METADATA_DESCRIPTION)));
31-
}
32-
33-
@Deprecated
34-
public static DataGenerator makePreset(Preset preset, RegistryAccess registryAccess, Path dataGenPath, Path dataGenOutputPath) {
35-
DataGenerator dataGenerator = new DataGenerator(dataGenPath, SharedConstants.getCurrentVersion(), true);
36-
PackGenerator packGenerator = dataGenerator.new PackGenerator(true, "preset", new PackOutput(dataGenOutputPath));
37-
CompletableFuture<HolderLookup.Provider> lookup = CompletableFuture.supplyAsync(() -> preset.buildPatch(registryAccess));
38-
39-
packGenerator.addProvider((output) -> {
40-
return DataGenUtil.createRegistryProvider(output, lookup);
41-
});
42-
packGenerator.addProvider((output) -> {
43-
return new PresetBlockTagsProvider(output, lookup);
44-
});
45-
packGenerator.addProvider((output) -> {
46-
return new PresetSurfaceLayerTags(preset, output, lookup);
47-
});
48-
packGenerator.addProvider((output) -> {
49-
return new PresetBiomeTagsProvider(preset, output, CompletableFuture.completedFuture(registryAccess));
50-
});
51-
packGenerator.addProvider((output) -> {
52-
return PackMetadataGenerator.forFeaturePack(output, Component.translatable(RTFTranslationKeys.PRESET_METADATA_DESCRIPTION));
53-
});
54-
return dataGenerator;
55-
}
56-
57-
public interface ResourcePackFactory {
58-
DataGenerator.PackGenerator createPack();
59-
}
60-
61-
public interface DataPackFactory {
62-
DataGenerator.PackGenerator createPack(ResourceLocation id);
63-
}
64-
}
1+
package raccoonman.reterraforged.data;
2+
3+
import java.nio.file.Path;
4+
import java.util.concurrent.CompletableFuture;
5+
6+
import net.minecraft.SharedConstants;
7+
import net.minecraft.core.HolderLookup;
8+
import net.minecraft.core.RegistryAccess;
9+
import net.minecraft.data.DataGenerator;
10+
import net.minecraft.data.DataGenerator.PackGenerator;
11+
import net.minecraft.data.PackOutput;
12+
import net.minecraft.data.metadata.PackMetadataGenerator;
13+
import net.minecraft.network.chat.Component;
14+
import net.minecraft.resources.ResourceLocation;
15+
import raccoonman.reterraforged.client.data.RTFLanguageProvider;
16+
import raccoonman.reterraforged.client.data.RTFTranslationKeys;
17+
import raccoonman.reterraforged.data.preset.settings.Preset;
18+
import raccoonman.reterraforged.data.preset.tags.PresetBiomeTagsProvider;
19+
import raccoonman.reterraforged.data.preset.tags.PresetBlockTagsProvider;
20+
import raccoonman.reterraforged.data.preset.tags.PresetSurfaceLayerProvider;
21+
import raccoonman.reterraforged.platform.DataGenUtil;
22+
23+
public class RTFDataGen {
24+
public static final String DATAPACK_PATH = "data/reterraforged/datapacks";
25+
26+
public static void generateResourcePacks(ResourcePackFactory resourcePackFactory) {
27+
DataGenerator.PackGenerator pack = resourcePackFactory.createPack();
28+
29+
pack.addProvider(RTFLanguageProvider.EnglishUS::new);
30+
pack.addProvider((PackOutput output) -> PackMetadataGenerator.forFeaturePack(output, Component.translatable(RTFTranslationKeys.METADATA_DESCRIPTION)));
31+
}
32+
33+
@Deprecated
34+
public static DataGenerator makePreset(Preset preset, RegistryAccess registryAccess, Path dataGenPath, Path dataGenOutputPath) {
35+
DataGenerator dataGenerator = new DataGenerator(dataGenPath, SharedConstants.getCurrentVersion(), true);
36+
PackGenerator packGenerator = dataGenerator.new PackGenerator(true, "preset", new PackOutput(dataGenOutputPath));
37+
CompletableFuture<HolderLookup.Provider> lookup = CompletableFuture.supplyAsync(() -> preset.buildPatch(registryAccess));
38+
39+
packGenerator.addProvider((output) -> {
40+
return DataGenUtil.createRegistryProvider(output, lookup);
41+
});
42+
packGenerator.addProvider((output) -> {
43+
return new PresetBlockTagsProvider(output, lookup);
44+
});
45+
packGenerator.addProvider((output) -> {
46+
return new PresetSurfaceLayerProvider(preset, output, lookup);
47+
});
48+
packGenerator.addProvider((output) -> {
49+
return new PresetBiomeTagsProvider(preset, output, CompletableFuture.completedFuture(registryAccess));
50+
});
51+
packGenerator.addProvider((output) -> {
52+
return PackMetadataGenerator.forFeaturePack(output, Component.translatable(RTFTranslationKeys.PRESET_METADATA_DESCRIPTION));
53+
});
54+
return dataGenerator;
55+
}
56+
57+
public interface ResourcePackFactory {
58+
DataGenerator.PackGenerator createPack();
59+
}
60+
61+
public interface DataPackFactory {
62+
DataGenerator.PackGenerator createPack(ResourceLocation id);
63+
}
64+
}

common/src/main/java/raccoonman/reterraforged/data/preset/PresetSurfaceLayerData.java

+16-46
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import raccoonman.reterraforged.data.preset.settings.Preset;
1717
import raccoonman.reterraforged.data.preset.settings.SurfaceSettings;
1818
import raccoonman.reterraforged.data.preset.settings.WorldSettings;
19+
import raccoonman.reterraforged.integration.terrablender.TBIntegration;
20+
import raccoonman.reterraforged.integration.terrablender.TBSurfaceRules;
1921
import raccoonman.reterraforged.registries.RTFRegistries;
2022
import raccoonman.reterraforged.tags.RTFBiomeTags;
2123
import raccoonman.reterraforged.tags.RTFSurfaceLayerTags;
@@ -24,32 +26,23 @@
2426
import raccoonman.reterraforged.world.worldgen.surface.rule.LayeredSurfaceRule;
2527
import raccoonman.reterraforged.world.worldgen.surface.rule.RTFSurfaceRules;
2628
import raccoonman.reterraforged.world.worldgen.util.Scaling;
29+
import terrablender.core.TerraBlender;
2730

2831
public class PresetSurfaceLayerData {
29-
public static final ResourceKey<LayeredSurfaceRule.Layer> VANILLA = createKey("preliminary_surface/vanilla");
30-
public static final ResourceKey<LayeredSurfaceRule.Layer> FOREST = createKey("preliminary_surface/forest");
31-
public static final ResourceKey<LayeredSurfaceRule.Layer> DESERT = createKey("preliminary_surface/desert");
32-
public static final ResourceKey<LayeredSurfaceRule.Layer> WINDSWEPT_HILLS = createKey("preliminary_surface/windswept_hills");
33-
public static final ResourceKey<LayeredSurfaceRule.Layer> WINDSWEPT_GRAVELLY_HILLS = createKey("preliminary_surface/windswept_gravelly_hills");
34-
public static final ResourceKey<LayeredSurfaceRule.Layer> FROZEN_PEAKS = createKey("preliminary_surface/frozen_peak");
35-
public static final ResourceKey<LayeredSurfaceRule.Layer> RIVER_BANK = createKey("preliminary_surface/river_bank");
36-
37-
public static final ResourceKey<LayeredSurfaceRule.Layer> ROCK_EROSION = createKey("erosion/rock");
38-
public static final ResourceKey<LayeredSurfaceRule.Layer> DIRT_EROSION = createKey("erosion/dirt");
39-
public static final ResourceKey<LayeredSurfaceRule.Layer> BADLANDS_EROSION = createKey("erosion/badlands");
40-
public static final ResourceKey<LayeredSurfaceRule.Layer> DESERT_EROSION = createKey("erosion/desert");
41-
public static final ResourceKey<LayeredSurfaceRule.Layer> EROSION = createKey("erosion");
32+
public static final ResourceKey<LayeredSurfaceRule.Layer> REGIONS_UNEXPLORED = createKey("regions_unexplored");
4233

4334
private static final SurfaceRules.RuleSource ORANGE_TERRACOTTA = makeStateRule(Blocks.ORANGE_TERRACOTTA);
4435
private static final SurfaceRules.RuleSource BROWN_TERRACOTTA = makeStateRule(Blocks.BROWN_TERRACOTTA);
4536
private static final SurfaceRules.RuleSource TERRACOTTA = makeStateRule(Blocks.TERRACOTTA);
4637
private static final SurfaceRules.RuleSource SMOOTH_SANDSTONE = makeStateRule(Blocks.SMOOTH_SANDSTONE);
4738

39+
private static final SurfaceRules.RuleSource GRASS = makeStateRule(Blocks.GRASS_BLOCK);
4840
private static final SurfaceRules.RuleSource DIRT = makeStateRule(Blocks.DIRT);
4941
private static final SurfaceRules.RuleSource PODZOL = makeStateRule(Blocks.PODZOL);
5042
private static final SurfaceRules.RuleSource STONE = makeStateRule(Blocks.STONE);
5143
private static final SurfaceRules.RuleSource COARSE_DIRT = makeStateRule(Blocks.COARSE_DIRT);
5244
private static final SurfaceRules.RuleSource GRAVEL = makeStateRule(Blocks.GRAVEL);
45+
private static final SurfaceRules.RuleSource SAND = makeStateRule(Blocks.SAND);
5346

5447
public static void bootstrap(Preset preset, BootstapContext<LayeredSurfaceRule.Layer> ctx) {
5548
WorldSettings worldSettings = preset.world();
@@ -61,22 +54,21 @@ public static void bootstrap(Preset preset, BootstapContext<LayeredSurfaceRule.L
6154
Scaling scaling = Scaling.make(properties.terrainScaler(), properties.seaLevel);
6255

6356
HolderGetter<Noise> noise = ctx.lookup(RTFRegistries.NOISE);
64-
65-
ctx.register(ROCK_EROSION, makeRockErosion());
66-
ctx.register(DIRT_EROSION, makeDirtErosion(noise, erosion));
67-
ctx.register(BADLANDS_EROSION, makeBadlandsErosion());
68-
ctx.register(EROSION, makeErosion(noise, erosion));
69-
70-
ctx.register(DESERT, makeDesert(scaling, noise));
71-
ctx.register(FOREST, makeForest(noise));
72-
ctx.register(RIVER_BANK, makeRiverBank(noise));
57+
ctx.register(REGIONS_UNEXPLORED, makeRU());
7358
}
7459

75-
private static LayeredSurfaceRule.Layer makeRockErosion() {
60+
private static LayeredSurfaceRule.Layer makeRU() {
7661
return LayeredSurfaceRule.layer(
77-
STONE
62+
SurfaceRules.ifTrue(
63+
RTFSurfaceConditions.modLoaded("regions_unexplored"),
64+
TBSurfaceRules.rule("OVERWORLD", "regions_unexplored")
65+
)
7866
);
7967
}
68+
69+
private static LayeredSurfaceRule.Layer makeRockErosion() {
70+
return LayeredSurfaceRule.layer(STONE);
71+
}
8072

8173
private static LayeredSurfaceRule.Layer makeDirtErosion(HolderGetter<Noise> noise, SurfaceSettings.Erosion settings) {
8274
return LayeredSurfaceRule.layer(
@@ -102,28 +94,6 @@ private static LayeredSurfaceRule.Layer makeBadlandsErosion() {
10294
);
10395
}
10496

105-
private static LayeredSurfaceRule.Layer makeErosion(HolderGetter<Noise> noise, SurfaceSettings.Erosion settings) {
106-
SurfaceRules.ConditionSource erodedRock = RTFSurfaceConditions.steepness(settings.rockSteepness, noise.getOrThrow(PresetSurfaceNoise.STEEPNESS_VARIANCE));
107-
SurfaceRules.ConditionSource erodedRockVariance = RTFSurfaceConditions.height(noise.getOrThrow(PresetSurfaceNoise.ERODED_ROCK), noise.getOrThrow(PresetSurfaceNoise.HEIGHT_VARIANCE));
108-
SurfaceRules.RuleSource erosionMaterial = RTFSurfaceRules.layered(RTFSurfaceLayerTags.EROSION);
109-
SurfaceRules.RuleSource erosionMaterialVariant = RTFSurfaceRules.layered(RTFSurfaceLayerTags.EROSION_VARIANT);
110-
return LayeredSurfaceRule.layer(
111-
SurfaceRules.ifTrue(
112-
erosionBiomeCheck(),
113-
SurfaceRules.sequence(
114-
SurfaceRules.ifTrue(
115-
erodedRock,
116-
erosionMaterial
117-
),
118-
SurfaceRules.ifTrue(
119-
erodedRockVariance,
120-
erosionMaterialVariant
121-
)
122-
)
123-
)
124-
);
125-
}
126-
12797
// private static LayeredSurfaceRule.Layer makeErosion(SurfaceSettings.Erosion erosion, HolderGetter<Noise> noise) {
12898
// SurfaceRules.ConditionSource erodedRock = RTFSurfaceConditions.steepness(erosion.rockSteepness, noise.getOrThrow(PresetSurfaceNoise.STEEPNESS_VARIANCE));
12999
// SurfaceRules.ConditionSource erodedRockVariance = RTFSurfaceConditions.height(noise.getOrThrow(PresetSurfaceNoise.ERODED_ROCK), noise.getOrThrow(PresetSurfaceNoise.HEIGHT_VARIANCE));

0 commit comments

Comments
 (0)