Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/generated/resources/assets/mia/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
"block.mia.verdant_stairs": "Verdant Stairs",
"block.mia.verdant_stem": "Verdant Stem",
"block.mia.verdant_trapdoor": "Verdant Trapdoor",
"config.jade.plugin_mia.spawner_cooldown": "Spawner Cooldown",
"container.mia.artifact.smithing.title": "Artifact Smithing Table",
"curios.identifier.whistle": "Whistle",
"curios.modifiers.whistle": "Whistle Attributes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"minecraft:diamond",
"minecraft:iron_ingot"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"mia:the_abyss/the_abyss",
"mia:the_abyss/inverted_forest"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"type": "mia:abyss_wall_template",
"anchor_name": "mia:abyss_wall_anchor",
"biomes": "#mia:has_abyss_windmill",
"plan": {
"attempts_per_band": 64,
"candidate_count": 20,
"contract_version": 4,
"embed_depth": 3,
"final_density_inward_search": 32,
"final_density_tolerance": 3,
"forbidden_max_y": 25,
"forbidden_min_y": -3,
"max_correction": 16,
"max_y": 125,
"min_anchor_distance": 32,
"min_y": -96,
"salt": 1296646487
},
"spawn_overrides": {},
"step": "underground_structures",
"straight_pool": "mia:abyss_windmill/straight",
"tilt_pool": "mia:abyss_windmill/tilt"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"placement": {
"type": "mia:abyss_wall",
"plan": {
"attempts_per_band": 64,
"candidate_count": 20,
"contract_version": 4,
"embed_depth": 3,
"final_density_inward_search": 32,
"final_density_tolerance": 3,
"forbidden_max_y": 25,
"forbidden_min_y": -3,
"max_correction": 16,
"max_y": 125,
"min_anchor_distance": 32,
"min_y": -96,
"salt": 1296646487
},
"salt": 1296646487
},
"structures": [
{
"structure": "mia:abyss_windmill",
"weight": 1
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"elements": [
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "mia:abyss_windmill_straight",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 1
}
],
"fallback": "minecraft:empty"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"elements": [
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "mia:abyss_windmill_tilt",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 1
}
],
"fallback": "minecraft:empty"
}
1 change: 1 addition & 0 deletions src/main/java/com/altnoir/mia/MIA.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public MIA(IEventBus modEventBus, ModContainer modContainer) {
MiaDensityFunctionTypes.register(modEventBus);
MiaFeatures.register(modEventBus);
MiaPlacements.register(modEventBus);
MiaStructurePlacementTypes.register(modEventBus);
MiaStructureTypes.register(modEventBus);
MiaFoliagePlacerTypes.register(modEventBus);
MiaTrunkPlacerTypes.register(modEventBus);
Expand Down
262 changes: 262 additions & 0 deletions src/main/java/com/altnoir/mia/MiaGameTests.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ protected void addTags(@NotNull HolderLookup.Provider provider) {
.add(Biomes.SPARSE_JUNGLE)
.add(Biomes.BAMBOO_JUNGLE)
.add(Biomes.MANGROVE_SWAMP);
tag(MiaTags.Biomes.HAS_ABYSS_WINDMILL)
.add(MiaBiomes.THE_ABYSS)
.add(MiaBiomes.INVERTED_FOREST);
}
}
2 changes: 2 additions & 0 deletions src/main/java/com/altnoir/mia/datagen/MiaLangProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ protected void addTranslations() {
addDefault("tooltip");
addDefault("ponder");

add("config.jade.plugin_mia.spawner_cooldown", "Spawner Cooldown");

MiaBiomes.BIOMES.forEach(biome -> {
add("biome.mia." + biome.location().getPath(), formatName(biome));
});
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/altnoir/mia/init/MiaTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static class Biomes {
public static final TagKey<Biome> HAS_ISLAND = create("has_island");
public static final TagKey<Biome> THE_ABYSS_CLEAR = create("the_abyss_clear");
public static final TagKey<Biome> HAS_STAR_COMPASS_TEMPLE = create("has_star_compass_temple");
public static final TagKey<Biome> HAS_ABYSS_WINDMILL = create("has_abyss_windmill");

private static TagKey<Biome> create(String name) {
return TagKey.create(Registries.BIOME, MiaUtil.miaId(name));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.altnoir.mia.init.worldgen;

import com.altnoir.mia.MIA;
import com.altnoir.mia.worldgen.structure.wall.AbyssWallStructurePlacement;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.level.levelgen.structure.placement.StructurePlacementType;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredRegister;

public final class MiaStructurePlacementTypes {
public static final DeferredRegister<StructurePlacementType<?>> STRUCTURE_PLACEMENT_TYPES =
DeferredRegister.create(BuiltInRegistries.STRUCTURE_PLACEMENT, MIA.MOD_ID);

public static final DeferredHolder<StructurePlacementType<?>, StructurePlacementType<AbyssWallStructurePlacement>> ABYSS_WALL =
STRUCTURE_PLACEMENT_TYPES.register("abyss_wall", () -> () -> AbyssWallStructurePlacement.CODEC);

private MiaStructurePlacementTypes() {
}

public static void register(IEventBus eventBus) {
STRUCTURE_PLACEMENT_TYPES.register(eventBus);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.altnoir.mia.MIA;
import com.altnoir.mia.worldgen.structure.MiaJigsawStructure;
import com.altnoir.mia.worldgen.structure.wall.AbyssWindmillStructure;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.level.levelgen.structure.StructureType;
import net.neoforged.bus.api.IEventBus;
Expand All @@ -13,6 +14,8 @@ public class MiaStructureTypes {

public static final DeferredHolder<StructureType<?>, StructureType<MiaJigsawStructure>> MIA_JIGSAW =
STRUCTURE_TYPE.register("jigsaw", () -> () -> MiaJigsawStructure.CODEC);
public static final DeferredHolder<StructureType<?>, StructureType<AbyssWindmillStructure>> ABYSS_WALL_TEMPLATE =
STRUCTURE_TYPE.register("abyss_wall_template", () -> () -> AbyssWindmillStructure.CODEC);

public static void register(IEventBus eventBus) {
STRUCTURE_TYPE.register(eventBus);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.altnoir.mia.worldgen.structure;

import com.altnoir.mia.util.MiaUtil;
import com.altnoir.mia.worldgen.structure.wall.AbyssWallPlanConfig;
import com.altnoir.mia.worldgen.structure.wall.AbyssWallStructurePlacement;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstrapContext;
Expand All @@ -18,6 +20,7 @@
public interface MiaStructureSets {
ResourceKey<StructureSet> STAR_COMPASS_RUINS = register("star_compass_ruins");
ResourceKey<StructureSet> ABYSS_STRONGHOLDS = register("abyss_strongholds");
ResourceKey<StructureSet> ABYSS_WINDMILLS = register("abyss_windmills");

static void bootstrap(BootstrapContext<StructureSet> context) {
HolderGetter<Structure> structure = context.lookup(Registries.STRUCTURE);
Expand All @@ -37,6 +40,13 @@ static void bootstrap(BootstrapContext<StructureSet> context) {
new ConcentricRingsStructurePlacement(32, 11, 64, biome.getOrThrow(BiomeTags.IS_OVERWORLD))
)
);
context.register(
ABYSS_WINDMILLS,
new StructureSet(
structure.getOrThrow(MiaStructures.ABYSS_WINDMILL),
new AbyssWallStructurePlacement(AbyssWallPlanConfig.DEFAULT)
)
);
}

private static ResourceKey<StructureSet> register(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import com.altnoir.mia.init.MiaTags;
import com.altnoir.mia.util.MiaUtil;
import com.altnoir.mia.worldgen.structure.pools.AbyssStrongholdPools;
import com.altnoir.mia.worldgen.structure.pools.AbyssWindmillPools;
import com.altnoir.mia.worldgen.structure.pools.StarCompassRuinsPools;
import com.altnoir.mia.worldgen.structure.wall.AbyssWallPlanConfig;
import com.altnoir.mia.worldgen.structure.wall.AbyssWindmillStructure;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstrapContext;
Expand Down Expand Up @@ -36,6 +39,7 @@
public class MiaStructures {
public static final ResourceKey<Structure> STAR_COMPASS_RUINS = createKey("star_compass_ruins");
public static final ResourceKey<Structure> ABYSS_STRONGHOLD = createKey("abyss_stronghold");
public static final ResourceKey<Structure> ABYSS_WINDMILL = createKey("abyss_windmill");

public static void bootstrap(BootstrapContext<Structure> context) {
HolderGetter<Biome> biome = context.lookup(Registries.BIOME);
Expand Down Expand Up @@ -93,6 +97,19 @@ public static void bootstrap(BootstrapContext<Structure> context) {
LiquidSettings.IGNORE_WATERLOGGING
)
);
context.register(
ABYSS_WINDMILL,
new AbyssWindmillStructure(
new Structure.StructureSettings.Builder(biome.getOrThrow(MiaTags.Biomes.HAS_ABYSS_WINDMILL))
.generationStep(GenerationStep.Decoration.UNDERGROUND_STRUCTURES)
.terrainAdapation(TerrainAdjustment.NONE)
.build(),
templatePool.getOrThrow(AbyssWindmillPools.STRAIGHT),
templatePool.getOrThrow(AbyssWindmillPools.TILT),
MiaUtil.miaId("abyss_wall_anchor"),
AbyssWallPlanConfig.DEFAULT
)
);
}

private static ResourceKey<Structure> createKey(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.altnoir.mia.worldgen.structure.pools;

import com.altnoir.mia.worldgen.MiaSructurePoolUtils;
import com.google.common.collect.ImmutableList;
import com.mojang.datafixers.util.Pair;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstrapContext;
import net.minecraft.data.worldgen.Pools;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;

public final class AbyssWindmillPools {
public static final ResourceKey<StructureTemplatePool> STRAIGHT = MiaPools.createKey("abyss_windmill/straight");
public static final ResourceKey<StructureTemplatePool> TILT = MiaPools.createKey("abyss_windmill/tilt");

private AbyssWindmillPools() {
}

public static void bootstrap(BootstrapContext<StructureTemplatePool> context) {
HolderGetter<StructureTemplatePool> pools = context.lookup(Registries.TEMPLATE_POOL);
Holder<StructureTemplatePool> empty = pools.getOrThrow(Pools.EMPTY);
context.register(STRAIGHT, new StructureTemplatePool(
empty,
ImmutableList.of(Pair.of(MiaSructurePoolUtils.single("abyss_windmill_straight"), 1)),
StructureTemplatePool.Projection.RIGID
));
context.register(TILT, new StructureTemplatePool(
empty,
ImmutableList.of(Pair.of(MiaSructurePoolUtils.single("abyss_windmill_tilt"), 1)),
StructureTemplatePool.Projection.RIGID
));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ public static void register(BootstrapContext<StructureTemplatePool> context, Str
public static void bootstrap(BootstrapContext<StructureTemplatePool> context) {
StarCompassRuinsPools.bootstrap(context);
AbyssStrongholdPools.bootstrap(context);
AbyssWindmillPools.bootstrap(context);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.altnoir.mia.worldgen.structure.wall;

import net.minecraft.core.BlockPos;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.Rotation;

public record AbyssWallCandidate(
int id,
double angle,
int y,
double predictedRadius,
BlockPos anchor,
ChunkPos startChunk,
Orientation orientation
) {
public enum TemplateKind {
STRAIGHT,
TILT
}

public record Orientation(TemplateKind templateKind, Rotation rotation) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.altnoir.mia.worldgen.structure.wall;

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;

public record AbyssWallPlanConfig(
int minY,
int maxY,
int candidateCount,
int minAnchorDistance,
int maxCorrection,
int embedDepth,
int attemptsPerBand,
int salt,
int contractVersion,
int forbiddenMinY,
int forbiddenMaxY,
int finalDensityInwardSearch,
int finalDensityTolerance
) {
public static final AbyssWallPlanConfig DEFAULT = new AbyssWallPlanConfig(
-96, 125, 20, 32, 16, 3, 64, 0x4D494157, 4,
-3, 25, 32, 3
);

public static final Codec<AbyssWallPlanConfig> CODEC = RecordCodecBuilder.create(instance -> instance.group(
Codec.intRange(-2048, 2048).fieldOf("min_y").forGetter(AbyssWallPlanConfig::minY),
Codec.intRange(-2048, 2048).fieldOf("max_y").forGetter(AbyssWallPlanConfig::maxY),
Codec.intRange(1, 64).fieldOf("candidate_count").forGetter(AbyssWallPlanConfig::candidateCount),
Codec.intRange(1, 1024).fieldOf("min_anchor_distance").forGetter(AbyssWallPlanConfig::minAnchorDistance),
Codec.intRange(1, 256).fieldOf("max_correction").forGetter(AbyssWallPlanConfig::maxCorrection),
Codec.intRange(0, 32).fieldOf("embed_depth").forGetter(AbyssWallPlanConfig::embedDepth),
Codec.intRange(1, 256).fieldOf("attempts_per_band").forGetter(AbyssWallPlanConfig::attemptsPerBand),
Codec.intRange(0, Integer.MAX_VALUE).fieldOf("salt").forGetter(AbyssWallPlanConfig::salt),
Codec.intRange(1, Integer.MAX_VALUE).fieldOf("contract_version").forGetter(AbyssWallPlanConfig::contractVersion),
Codec.intRange(-2048, 2048).fieldOf("forbidden_min_y").forGetter(AbyssWallPlanConfig::forbiddenMinY),
Codec.intRange(-2048, 2048).fieldOf("forbidden_max_y").forGetter(AbyssWallPlanConfig::forbiddenMaxY),
Codec.intRange(0, 256).fieldOf("final_density_inward_search").forGetter(AbyssWallPlanConfig::finalDensityInwardSearch),
Codec.intRange(0, 256).fieldOf("final_density_tolerance").forGetter(AbyssWallPlanConfig::finalDensityTolerance)
).apply(instance, AbyssWallPlanConfig::new));

public AbyssWallPlanConfig {
if (maxY < minY) {
throw new IllegalArgumentException("maxY must be greater than or equal to minY");
}
if (forbiddenMaxY < forbiddenMinY) {
throw new IllegalArgumentException("forbiddenMaxY must be greater than or equal to forbiddenMinY");
}
}

public int maxWallAnchorOffset() {
return this.embedDepth;
}

public int planningAnchorDistance() {
int maximumAnchorShift = (int) Math.ceil(
this.maxCorrection + this.maxWallAnchorOffset() + Math.sqrt(2.0)
);
return this.minAnchorDistance + 2 * maximumAnchorShift;
}
}
Loading
Loading