mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 11:36:43 +01:00
Move structures an clean up how they're added to biomes
This commit is contained in:
parent
ca70c87b04
commit
2cac91c351
11 changed files with 34 additions and 38 deletions
|
@ -1,6 +1,5 @@
|
|||
package com.minelittlepony.unicopia.structure;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
@ -19,7 +18,6 @@ import net.minecraft.util.math.BlockBox;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biomes;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.decorator.Decorator;
|
||||
|
@ -37,25 +35,14 @@ class CloudDungeonFeature extends AbstractTempleFeature<DefaultFeatureConfig> {
|
|||
new Identifier("unicopia", "cloud/island_small")
|
||||
};
|
||||
|
||||
public CloudDungeonFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> func) {
|
||||
public CloudDungeonFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> func, Biome...biomes) {
|
||||
super(func);
|
||||
|
||||
Arrays.asList(
|
||||
Biomes.OCEAN,
|
||||
Biomes.WOODED_BADLANDS_PLATEAU,
|
||||
Biomes.DESERT,
|
||||
Biomes.DESERT_HILLS,
|
||||
Biomes.JUNGLE,
|
||||
Biomes.JUNGLE_HILLS,
|
||||
Biomes.SWAMP,
|
||||
Biomes.SWAMP_HILLS,
|
||||
Biomes.ICE_SPIKES,
|
||||
Biomes.TAIGA
|
||||
).forEach(biome -> {
|
||||
for (Biome biome : biomes) {
|
||||
biome.addFeature(GenerationStep.Feature.LOCAL_MODIFICATIONS, configure(FeatureConfig.DEFAULT)
|
||||
.createDecoratedFeature(Decorator.NOPE
|
||||
.configure(NopeDecoratorConfig.DEFAULT)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.minelittlepony.unicopia.structure;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
@ -19,7 +18,6 @@ import net.minecraft.util.math.BlockBox;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biomes;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.decorator.Decorator;
|
||||
|
@ -39,26 +37,14 @@ class RuinFeature extends AbstractTempleFeature<DefaultFeatureConfig> {
|
|||
new Identifier("unicopia", "ground/wizard_tower_blue")
|
||||
};
|
||||
|
||||
public RuinFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> func) {
|
||||
public RuinFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> func, Biome... biomes) {
|
||||
super(func);
|
||||
|
||||
Arrays.asList(
|
||||
Biomes.TAIGA,
|
||||
Biomes.TAIGA_HILLS,
|
||||
Biomes.GIANT_TREE_TAIGA,
|
||||
Biomes.GIANT_TREE_TAIGA_HILLS,
|
||||
Biomes.SNOWY_TAIGA,
|
||||
Biomes.SNOWY_TAIGA_HILLS,
|
||||
Biomes.GIANT_SPRUCE_TAIGA,
|
||||
Biomes.GIANT_TREE_TAIGA_HILLS,
|
||||
Biomes.SNOWY_TAIGA_MOUNTAINS,
|
||||
Biomes.DARK_FOREST,
|
||||
Biomes.DARK_FOREST_HILLS
|
||||
).forEach(biome -> {
|
||||
for (Biome biome : biomes) {
|
||||
biome.addFeature(GenerationStep.Feature.SURFACE_STRUCTURES,
|
||||
configure(FeatureConfig.DEFAULT)
|
||||
.createDecoratedFeature(Decorator.NOPE.configure(DecoratorConfig.DEFAULT)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.structure.StructurePieceType;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biomes;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.decorator.CountExtraChanceDecoratorConfig;
|
||||
import net.minecraft.world.gen.decorator.Decorator;
|
||||
|
@ -19,15 +20,37 @@ public interface UStructures {
|
|||
StructurePieceType CLOUD_HOUSE_PART = part("cloud_house", CloudDungeonFeature.Piece::new);
|
||||
StructurePieceType RUIN_PART = part("ruin", RuinFeature.Piece::new);
|
||||
|
||||
StructureFeature<DefaultFeatureConfig> CLOUD_HOUSE = feature("cloud_house", new CloudDungeonFeature(DefaultFeatureConfig::deserialize));
|
||||
StructureFeature<DefaultFeatureConfig> RUIN = feature("ruin", new RuinFeature(DefaultFeatureConfig::deserialize));
|
||||
StructureFeature<DefaultFeatureConfig> CLOUD_HOUSE = feature("cloud_house", new CloudDungeonFeature(DefaultFeatureConfig::deserialize, Biomes.OCEAN,
|
||||
Biomes.WOODED_BADLANDS_PLATEAU,
|
||||
Biomes.DESERT,
|
||||
Biomes.DESERT_HILLS,
|
||||
Biomes.JUNGLE,
|
||||
Biomes.JUNGLE_HILLS,
|
||||
Biomes.SWAMP,
|
||||
Biomes.SWAMP_HILLS,
|
||||
Biomes.ICE_SPIKES,
|
||||
Biomes.TAIGA));
|
||||
StructureFeature<DefaultFeatureConfig> RUIN = feature("ruin", new RuinFeature(DefaultFeatureConfig::deserialize,
|
||||
Biomes.TAIGA,
|
||||
Biomes.TAIGA_HILLS,
|
||||
Biomes.GIANT_TREE_TAIGA,
|
||||
Biomes.GIANT_TREE_TAIGA_HILLS,
|
||||
Biomes.SNOWY_TAIGA,
|
||||
Biomes.SNOWY_TAIGA_HILLS,
|
||||
Biomes.GIANT_SPRUCE_TAIGA,
|
||||
Biomes.GIANT_TREE_TAIGA_HILLS,
|
||||
Biomes.SNOWY_TAIGA_MOUNTAINS,
|
||||
Biomes.DARK_FOREST,
|
||||
Biomes.DARK_FOREST_HILLS
|
||||
));
|
||||
|
||||
static StructurePieceType part(String id, StructurePieceType type) {
|
||||
return Registry.register(Registry.STRUCTURE_PIECE, new Identifier("unicopia", id), type);
|
||||
}
|
||||
|
||||
static <C extends FeatureConfig, F extends Feature<C>> F feature(String id, F feature) {
|
||||
return Registry.register(Registry.FEATURE, new Identifier("unicopia", id), feature);
|
||||
static <C extends FeatureConfig, F extends StructureFeature<C>> F feature(String name, F feature) {
|
||||
Identifier id = new Identifier("unicopia", name);
|
||||
return Registry.register(Registry.STRUCTURE_FEATURE, id, Registry.register(Registry.FEATURE, id, feature));
|
||||
}
|
||||
|
||||
static void bootstrap() {
|
||||
|
@ -41,7 +64,7 @@ public interface UStructures {
|
|||
Feature.FANCY_TREE.configure(CustomSaplingGenerator.APPLE_TREE.fancyConfig).withChance(0.01F)),
|
||||
Feature.NORMAL_TREE.configure(CustomSaplingGenerator.APPLE_TREE.config)
|
||||
))
|
||||
.createDecoratedFeature(Decorator.COUNT_EXTRA_HEIGHTMAP.configure(new CountExtraChanceDecoratorConfig(10, 0.1F, 1))));
|
||||
.createDecoratedFeature(Decorator.COUNT_EXTRA_HEIGHTMAP.configure(new CountExtraChanceDecoratorConfig(0, 0.1F, 3))));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue