Skip to content

Commit

Permalink
removed biomes datagen and now works on json
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeCraftPlugin committed Dec 1, 2023
1 parent c1397df commit a13f8c3
Show file tree
Hide file tree
Showing 12 changed files with 236 additions and 230 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
import me.codecraft.darkendepths.datagen.*;
import me.codecraft.darkendepths.datagen.loottables.DarkenDepthsBlockLootTablesGenerator;
import me.codecraft.darkendepths.datagen.tags.DarkenDepthsBlockMiningLevelGenerator;
import me.codecraft.darkendepths.world.DarkenDepthsBiomesBootStrap;
import me.codecraft.darkendepths.world.DarkenDepthsConfiguredFeatures;
import me.codecraft.darkendepths.world.DarkenDepthsPlacedFeatures;
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.minecraft.registry.RegistryBuilder;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.world.gen.feature.OrePlacedFeatures;
import org.jetbrains.annotations.Nullable;

public class DarkenDepthsDataGenerator implements DataGeneratorEntrypoint {
Expand All @@ -30,7 +28,6 @@ public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
public void buildRegistry(RegistryBuilder registryBuilder) {
registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, DarkenDepthsConfiguredFeatures::bootstrap);
registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, DarkenDepthsPlacedFeatures::bootstrap);
registryBuilder.addRegistry(RegistryKeys.BIOME, DarkenDepthsBiomesBootStrap::bootstrap);
// OrePlacedFeatures
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package me.codecraft.darkendepths;

import me.codecraft.darkendepths.world.biome.custom.DarkenDepthRegion;
import me.codecraft.darkendepths.world.biome.custom.DarkenDepthSurfaceRuleData;
import me.codecraft.darkendepths.world.biome.custom.TestRegion1;
import me.codecraft.darkendepths.world.biome.custom.TestRegion2;
import me.codecraft.darkendepths.world.biome.custom.TestSurfaceRuleData;
import net.minecraft.util.Identifier;
import terrablender.api.RegionType;
import terrablender.api.Regions;
import terrablender.api.SurfaceRuleManager;
import terrablender.api.TerraBlenderApi;
Expand All @@ -17,8 +19,9 @@ public void onTerraBlenderInitialized() {
// Weights are kept intentionally low as we add minimal biomes
Regions.register(new TestRegion1(new Identifier(MOD_ID, "overworld_1"), 10));
Regions.register(new TestRegion2(new Identifier(MOD_ID, "overworld_2"), 12));
Regions.register(new DarkenDepthRegion(new Identifier(MOD_ID, "overworld_3"), RegionType.OVERWORLD, 2));

// Register our surface rules
// SurfaceRuleManager.addSurfaceRules(SurfaceRuleManager.RuleCategory.OVERWORLD, MOD_ID, TestSurfaceRuleData.makeRules());
// SurfaceRuleManager.addSurfaceRules(SurfaceRuleManager.RuleCategory.OVERWORLD, MOD_ID, DarkenDepthSurfaceRuleData.makeRules());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public DarkenDepthsWorldGenerator(FabricDataOutput output, CompletableFuture<Reg
protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) {
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.CONFIGURED_FEATURE));
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.PLACED_FEATURE));
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.BIOME));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package me.codecraft.darkendepths.world.biome.custom;
package me.codecraft.darkendepths.world;


import me.codecraft.darkendepths.DarkenDepths;
Expand All @@ -24,11 +24,11 @@
import net.minecraft.util.Identifier;
import net.minecraft.world.biome.Biome;

public class TestBiomes
public class DarkenDepthsBiomes
{
public static final RegistryKey<Biome> HOT_RED = register("hot_red");
public static final RegistryKey<Biome> COLD_BLUE = register("cold_blue");

public static final RegistryKey<Biome> DARKENED_DEPTHS = register("darkened_depths");
private static RegistryKey<Biome> register(String name)
{
return RegistryKey.of(RegistryKeys.BIOME, new Identifier(DarkenDepths.MOD_ID, name));
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package me.codecraft.darkendepths.world.biome.custom;

import com.mojang.datafixers.util.Pair;
import me.codecraft.darkendepths.world.DarkenDepthsBiomes;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.util.Identifier;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
import terrablender.api.Region;
import terrablender.api.RegionType;

import java.util.function.Consumer;

public class DarkenDepthRegion extends Region {
public DarkenDepthRegion(Identifier name, RegionType type, int weight) {
super(name, type, weight);
}


@Override
public void addBiomes(Registry<Biome> registry, Consumer<Pair<MultiNoiseUtil.NoiseHypercube, RegistryKey<Biome>>> mapper) {
this.addModifiedVanillaOverworldBiomes(mapper, builder -> {
builder.replaceBiome(BiomeKeys.DEEP_DARK, DarkenDepthsBiomes.DARKENED_DEPTHS);
});
super.addBiomes(registry, mapper);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,36 @@
*/
package me.codecraft.darkendepths.world.biome.custom;

import me.codecraft.darkendepths.blocks.DarkenDepthsBlocks;
import me.codecraft.darkendepths.world.DarkenDepthsBiomes;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.world.gen.surfacebuilder.MaterialRules;

public class TestSurfaceRuleData
public class DarkenDepthSurfaceRuleData
{
private static final MaterialRules.MaterialRule DIRT = makeStateRule(Blocks.DIRT);
private static final MaterialRules.MaterialRule GRASS_BLOCK = makeStateRule(Blocks.GRASS_BLOCK);
private static final MaterialRules.MaterialRule RED_TERRACOTTA = makeStateRule(Blocks.RED_TERRACOTTA);
private static final MaterialRules.MaterialRule BLUE_TERRACOTTA = makeStateRule(Blocks.BLUE_TERRACOTTA);
private static final MaterialRules.MaterialRule TEST = makeStateRule(DarkenDepthsBlocks.DARKENED_STONE_ORE);

public static MaterialRules.MaterialRule makeRules()
{
MaterialRules.MaterialCondition isAtOrAboveWaterLevel = MaterialRules.water(-1, 0);
MaterialRules.MaterialRule grassSurface = MaterialRules.sequence(MaterialRules.condition(isAtOrAboveWaterLevel, GRASS_BLOCK), DIRT);

return MaterialRules.sequence(
MaterialRules.condition(MaterialRules.biome(TestBiomes.HOT_RED), RED_TERRACOTTA),
MaterialRules.condition(MaterialRules.biome(TestBiomes.COLD_BLUE),BLUE_TERRACOTTA ),
MaterialRules.condition(MaterialRules.biome(DarkenDepthsBiomes.HOT_RED), RED_TERRACOTTA),
MaterialRules.condition(MaterialRules.biome(DarkenDepthsBiomes.DARKENED_DEPTHS),BLUE_TERRACOTTA ),
MaterialRules.condition(MaterialRules.biome(DarkenDepthsBiomes.DARKENED_DEPTHS),TEST),

// Default to a grass and dirt surface
MaterialRules.condition(MaterialRules.STONE_DEPTH_FLOOR, grassSurface)
);
}

private static MaterialRules.MaterialRule makeStateRule(Block block)
private static MaterialRules.MaterialRule makeStateRule(Block block)
{
return MaterialRules.block(block.getDefaultState());
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package me.codecraft.darkendepths.world.biome.custom;

import com.mojang.datafixers.util.Pair;
import me.codecraft.darkendepths.world.DarkenDepthsBiomes;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.util.Identifier;
Expand Down Expand Up @@ -50,7 +51,7 @@ public void addBiomes(Registry<Biome> registry, Consumer<Pair<MultiNoiseUtil.Noi
.erosion(Erosion.EROSION_0, Erosion.EROSION_1)
.depth(Depth.SURFACE, Depth.FLOOR)
.weirdness(Weirdness.MID_SLICE_NORMAL_ASCENDING, Weirdness.MID_SLICE_NORMAL_DESCENDING)
.build().forEach(point -> builder.add(point, TestBiomes.COLD_BLUE));
.build().forEach(point -> builder.add(point, DarkenDepthsBiomes.COLD_BLUE));

// Add our points to the mapper
builder.build().forEach(mapper::accept);
Expand Down
Loading

0 comments on commit a13f8c3

Please sign in to comment.