diff --git a/build.gradle b/build.gradle index 66d42dc..d09e7fe 100644 --- a/build.gradle +++ b/build.gradle @@ -12,19 +12,53 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' -def build_number = '77' +// ***************************************** // +// // +// Standard versioning system // +// // +// ***************************************** // +def majorVersion = 7 +def minorVersion = 2 +def buildVersion = 77 def isExperimental = true -version = "6.7.2.${build_number}" +version = "${majorVersion}.${minorVersion}.${buildVersion}" if (isExperimental) { version += '-experimental' } + +// ***************************************** // +// // +// Janoeo versioning system // +// // +// ***************************************** // +def isJanoeo = true +def janoeoProjectVersion = 6 +if (isJanoeo) { + version = "${janoeoProjectVersion}.${version}" +} + group = 'fr.alasdiablo.janoeo.foundation' archivesBaseName = 'Janoeo Foundation' -java.toolchain.languageVersion = JavaLanguageVersion.of(16) +def manifestAttributes = [ + "Specification-Title" : "Janoeo Foundation", + "Specification-Vendor" : "AlasDiablo, Safyrus", + "Specification-Version" : "1", + "Implementation-Title" : project.name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : "AlasDiablo, Safyrus", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") +] + +def outputFolder = file(rootProject.getRootDir().getPath() + '/output') + +java.toolchain.languageVersion = JavaLanguageVersion.of(17) + +def deobfSourceClassifier minecraft { - mappings channel: 'official', version: '1.17.1' + mappings channel: 'official', version: '1.18.1' + deobfSourceClassifier = getMappings().get() runs { client { workingDirectory project.file('run') @@ -68,33 +102,37 @@ repositories { } dependencies { - minecraft 'net.minecraftforge:forge:1.17.1-37.0.110' - implementation fg.deobf("curse.maven:diabololib-422014:3536336") // Diabolo Lib - // Compatibility check with mod - implementation fg.deobf("curse.maven:jei-238222:3438501") // JEI - implementation fg.deobf("curse.maven:jeresources-240630:3489131") - implementation fg.deobf("curse.maven:biomes-o-plenty-220318:3399675") // Biomes O' Plenty - implementation fg.deobf("curse.maven:catalogue-459701:3399552") // Catalogue - implementation fg.deobf("curse.maven:jade-324717:3439658") // Jade 🔍 - // implementation fg.deobf("curse.maven:infinitylib-251396:3367362") // InfinityLib - // implementation fg.deobf("curse.maven:agricraft-225635:3379947") // Agricraft - // implementation fg.deobf("curse.maven:mantle-74924:3389377") // Mantle - // implementation fg.deobf("curse.maven:tinkers-construct-74072:3389395") // Tinkers Construct 3 - // implementation fg.deobf("curse.maven:iron-chests-228756:3105315") // Iron Chests + minecraft 'net.minecraftforge:forge:1.18.1-39.0.5' + implementation 'curse.maven:diabololib-422014:3571204' // DiaboloLib + implementation fg.deobf('curse.maven:catalogue-459701:3559402') // Catalogue + implementation fg.deobf('curse.maven:jei-238222:3569553') // JEI + implementation fg.deobf('curse.maven:jer-240630:3562195') // JER } jar { - manifest.attributes([ - "Specification-Title" : "Janoeo Foundation", - "Specification-Vendor" : "AlasDiablo, lIotaMiu, Safyrus", - "Specification-Version" : "1", - "Implementation-Title" : project.name, - "Implementation-Version" : project.jar.archiveVersion, - "Implementation-Vendor" :"AlasDiablo, lIotaMiu, Safyrus", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") - ]) - + manifest.attributes(manifestAttributes) destinationDirectory.set(file(rootProject.getRootDir().getPath() + '/output')) } jar.finalizedBy('reobfJar') + +task sourcesJar(type: Jar) { + from sourceSets.main.allJava + def archiveName = 'sources-' + deobfSourceClassifier + archiveClassifier.set(archiveName) + destinationDirectory.set(outputFolder) +} + +task deobfJar(type: Jar) { + from sourceSets.main.output + def archiveName = 'deobf-' + deobfSourceClassifier + archiveClassifier.set(archiveName) + manifest.attributes(manifestAttributes) + destinationDirectory.set(outputFolder) +} + +artifacts { + archives jar + archives sourcesJar + archives deobfJar +} diff --git a/changelog.md b/changelog.md index 730d642..0da20cd 100644 --- a/changelog.md +++ b/changelog.md @@ -2,9 +2,14 @@ ## Summary -
1.17.1 +
1.18.1 + [6.7.2.77](#67277) + +
+ +
1.17.1 + + [6.6.2.76-experimental](#66276-experimental) + [6.6.1.74-experimental](#66174-experimental) + [6.6.0.73-experimental](#66073-experimental) @@ -110,11 +115,7 @@ #### Update -+ forge from 37.0.33 to 37.0.45 - -#### Add - -[...] ++ port mod to mc 1.18.1 ### 6.6.2.76-experimental diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a2..e750102 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/Foundation.java b/src/main/java/fr/alasdiablo/janoeo/foundation/Foundation.java index fcf6b15..467afc8 100644 --- a/src/main/java/fr/alasdiablo/janoeo/foundation/Foundation.java +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/Foundation.java @@ -1,15 +1,14 @@ package fr.alasdiablo.janoeo.foundation; -import fr.alasdiablo.diolib.gui.GroundItemGroup; +import fr.alasdiablo.diolib.item.GroundCreativeModeTab; import fr.alasdiablo.janoeo.foundation.compatibility.JERCompat; import fr.alasdiablo.janoeo.foundation.config.FoundationConfig; import fr.alasdiablo.janoeo.foundation.data.*; import fr.alasdiablo.janoeo.foundation.data.language.EnglishProvider; import fr.alasdiablo.janoeo.foundation.data.language.FrenchProvider; import fr.alasdiablo.janoeo.foundation.init.FoundationBlocks; +import fr.alasdiablo.janoeo.foundation.init.FoundationGeneration; import fr.alasdiablo.janoeo.foundation.init.FoundationItems; -import fr.alasdiablo.janoeo.foundation.world.WorldGen; -import fr.alasdiablo.janoeo.foundation.world.gen.FoundationFeatures; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.data.DataGenerator; import net.minecraft.world.item.CreativeModeTab; @@ -18,6 +17,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.IEventBus; @@ -37,14 +37,14 @@ public class Foundation { public static final Logger logger = LogManager.getLogger(Registries.MOD_ID); - public static final CreativeModeTab ITEMS_GROUP = new GroundItemGroup("janoeo.foundation.item") { + public static final CreativeModeTab ITEMS_GROUP = new GroundCreativeModeTab("janoeo.foundation.item") { @Override public ItemStack makeIcon() { return new ItemStack(Items.COAL); } }; - public static final CreativeModeTab BLOCKS_GROUP = new GroundItemGroup("janoeo.foundation.block") { + public static final CreativeModeTab BLOCKS_GROUP = new GroundCreativeModeTab("janoeo.foundation.block") { @Override public ItemStack makeIcon() { return new ItemStack(Blocks.COAL_BLOCK); @@ -100,7 +100,6 @@ private void gatherData(GatherDataEvent event) { } private void setup(final FMLCommonSetupEvent commonSetupEvent) { - WorldGen.init(); this.initCompat(); } @@ -113,7 +112,7 @@ private void initCompat() { } private void initFeatures(RegistryEvent.NewRegistry newRegistry) { - FoundationFeatures.init(); + MinecraftForge.EVENT_BUS.addListener(FoundationGeneration::onBiomeLoading); } public static class Compat { diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/block/OreBlock.java b/src/main/java/fr/alasdiablo/janoeo/foundation/block/OreBlock.java index d2ce7c0..0d8ab60 100644 --- a/src/main/java/fr/alasdiablo/janoeo/foundation/block/OreBlock.java +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/block/OreBlock.java @@ -1,7 +1,7 @@ package fr.alasdiablo.janoeo.foundation.block; -import fr.alasdiablo.diolib.generic.ExperienceRarity; -import fr.alasdiablo.diolib.generic.IDropExperience; +import fr.alasdiablo.diolib.block.ExperienceRarity; +import fr.alasdiablo.diolib.block.IDropExperience; import net.minecraft.core.BlockPos; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.state.BlockState; diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/block/RedstoneOreBlock.java b/src/main/java/fr/alasdiablo/janoeo/foundation/block/RedstoneOreBlock.java index 8af9e3e..ac80763 100644 --- a/src/main/java/fr/alasdiablo/janoeo/foundation/block/RedstoneOreBlock.java +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/block/RedstoneOreBlock.java @@ -1,7 +1,7 @@ package fr.alasdiablo.janoeo.foundation.block; -import fr.alasdiablo.diolib.generic.ExperienceRarity; -import fr.alasdiablo.diolib.generic.IDropExperience; +import fr.alasdiablo.diolib.block.ExperienceRarity; +import fr.alasdiablo.diolib.block.IDropExperience; import net.minecraft.core.BlockPos; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.RedStoneOreBlock; diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/compatibility/JERCompat.java b/src/main/java/fr/alasdiablo/janoeo/foundation/compatibility/JERCompat.java index 65f3509..25e7602 100644 --- a/src/main/java/fr/alasdiablo/janoeo/foundation/compatibility/JERCompat.java +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/compatibility/JERCompat.java @@ -22,8 +22,6 @@ public class JERCompat { private static DistributionBase getDistribution(OreConfig config) { DistributionBase distribution; switch (config.getPlacement()) { - case "range" -> distribution = new DistributionSquare( - config.getCount(), config.getSize(), 0, config.getRange()); case "triangle" -> distribution = new DistributionTriangular( (config.getTop() - config.getBottom()) / 2 + config.getBottom(), config.getTop() - config.getBottom() / 2, diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/config/FoundationConfig.java b/src/main/java/fr/alasdiablo/janoeo/foundation/config/FoundationConfig.java index 8f7e2ba..fcb715b 100644 --- a/src/main/java/fr/alasdiablo/janoeo/foundation/config/FoundationConfig.java +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/config/FoundationConfig.java @@ -7,29 +7,30 @@ public class FoundationConfig { - public static final OreConfig TINY_COAL_ORE_CONFIG = new OreConfig(Registries.TINY_COAL_ORE, true).placementRange(17, 128, 20); - public static final OreConfig TINY_COPPER_ORE_CONFIG = new OreConfig(Registries.TINY_COPPER_ORE, true).placementUniform(10, 0, 96, 6); - public static final OreConfig TINY_DIAMOND_ORE_CONFIG = new OreConfig(Registries.TINY_DIAMOND_ORE, true).placementRange(8, 16, 4); - public static final OreConfig TINY_EMERALD_ORE_CONFIG = new OreConfig(Registries.TINY_EMERALD_ORE, true).placementUniform(2, 4, 31, 4); - public static final OreConfig TINY_GOLD_ORE_CONFIG = new OreConfig(Registries.TINY_GOLD_ORE, true).placementRange(9, 32, 2); - public static final OreConfig TINY_GOLD_ORE_EXTRA_CONFIG = new OreConfig(Registries.TINY_GOLD_ORE + "_extra", true).placementUniform(9, 32, 80, 20); - public static final OreConfig TINY_IRON_ORE_CONFIG = new OreConfig(Registries.TINY_IRON_ORE, true).placementRange(9, 64, 20); - public static final OreConfig TINY_LAPIS_ORE_CONFIG = new OreConfig(Registries.TINY_LAPIS_ORE, true).placementTriangle(7, 16, 16); - public static final OreConfig TINY_REDSTONE_ORE_CONFIG = new OreConfig(Registries.TINY_REDSTONE_ORE, true).placementRange(8, 16, 8); - public static final OreConfig BAUXITE_ORE_CONFIG = new OreConfig(Registries.BAUXITE_ORE, true).placementRange(10, 96, 6); - public static final OreConfig LEAD_ORE_CONFIG = new OreConfig(Registries.LEAD_ORE, true).placementRange(6, 48, 6); - public static final OreConfig NICKEL_ORE_CONFIG = new OreConfig(Registries.NICKEL_ORE, true).placementRange(6, 32, 4); - public static final OreConfig SILVER_ORE_CONFIG = new OreConfig(Registries.SILVER_ORE, true).placementRange(6, 28, 4); - public static final OreConfig TIN_ORE_CONFIG = new OreConfig(Registries.TIN_ORE, true).placementRange(10, 96, 6); - public static final OreConfig URANIUM_ORE_CONFIG = new OreConfig(Registries.URANIUM_ORE, true).placementRange(6, 28, 4); - public static final OreConfig TINY_BAUXITE_ORE_CONFIG = new OreConfig(Registries.TINY_BAUXITE_ORE, true).placementRange(10, 96, 6); - public static final OreConfig TINY_LEAD_ORE_CONFIG = new OreConfig(Registries.TINY_LEAD_ORE, true).placementRange(6, 48, 6); - public static final OreConfig TINY_NICKEL_ORE_CONFIG = new OreConfig(Registries.TINY_NICKEL_ORE, true).placementRange(6, 32, 4); - public static final OreConfig TINY_SILVER_ORE_CONFIG = new OreConfig(Registries.TINY_SILVER_ORE, true).placementRange(6, 28, 4); - public static final OreConfig TINY_TIN_ORE_CONFIG = new OreConfig(Registries.TINY_TIN_ORE, true).placementRange(10, 96, 6); - public static final OreConfig TINY_URANIUM_ORE_CONFIG = new OreConfig(Registries.TINY_URANIUM_ORE, true).placementRange(6, 28, 4); - private static final JsonConfigBuilder OVERWORLD_ORE_TINY_CONFIG = new JsonConfigBuilder("janoeo", "foundation", "overworld", "tiny"); - private static final JsonConfigBuilder OVERWORLD_ORE_CONFIG = new JsonConfigBuilder("janoeo", "foundation", "overworld"); + public static final OreConfig TINY_COAL_ORE_CONFIG = new OreConfig(Registries.TINY_COAL_ORE, true).placementUniform(17, -24, 180, 20); + public static final OreConfig TINY_COPPER_ORE_CONFIG = new OreConfig(Registries.TINY_COPPER_ORE, true).placementUniform(10, -16, 112, 6); + public static final OreConfig TINY_DIAMOND_ORE_CONFIG = new OreConfig(Registries.TINY_DIAMOND_ORE, true).placementUniform(8, -24, 16, 4); + public static final OreConfig TINY_EMERALD_ORE_CONFIG = new OreConfig(Registries.TINY_EMERALD_ORE, true).placementUniform(2, 4, 31, 4); + public static final OreConfig TINY_GOLD_ORE_CONFIG = new OreConfig(Registries.TINY_GOLD_ORE, true).placementUniform(9, -64, 32, 2); + public static final OreConfig TINY_GOLD_ORE_EXTRA_CONFIG = new OreConfig(Registries.TINY_GOLD_ORE + "_extra", true).placementUniform( + 9, 32, 80, 20); + public static final OreConfig TINY_IRON_ORE_CONFIG = new OreConfig(Registries.TINY_IRON_ORE, true).placementUniform(9, -24, 180, 20); + public static final OreConfig TINY_LAPIS_ORE_CONFIG = new OreConfig(Registries.TINY_LAPIS_ORE, true).placementTriangle(7, 16, 16); + public static final OreConfig TINY_REDSTONE_ORE_CONFIG = new OreConfig(Registries.TINY_REDSTONE_ORE, true).placementUniform(8, -16, 16, 8); + public static final OreConfig BAUXITE_ORE_CONFIG = new OreConfig(Registries.BAUXITE_ORE, true).placementUniform(10, 0, 96, 6); + public static final OreConfig LEAD_ORE_CONFIG = new OreConfig(Registries.LEAD_ORE, true).placementUniform(6, 0, 48, 6); + public static final OreConfig NICKEL_ORE_CONFIG = new OreConfig(Registries.NICKEL_ORE, true).placementUniform(6, 0, 32, 4); + public static final OreConfig SILVER_ORE_CONFIG = new OreConfig(Registries.SILVER_ORE, true).placementUniform(6, -16, 28, 4); + public static final OreConfig TIN_ORE_CONFIG = new OreConfig(Registries.TIN_ORE, true).placementUniform(10, 0, 96, 6); + public static final OreConfig URANIUM_ORE_CONFIG = new OreConfig(Registries.URANIUM_ORE, true).placementUniform(6, -24, 28, 4); + public static final OreConfig TINY_BAUXITE_ORE_CONFIG = new OreConfig(Registries.TINY_BAUXITE_ORE, true).placementUniform(10, 0, 96, 6); + public static final OreConfig TINY_LEAD_ORE_CONFIG = new OreConfig(Registries.TINY_LEAD_ORE, true).placementUniform(6, 0, 48, 6); + public static final OreConfig TINY_NICKEL_ORE_CONFIG = new OreConfig(Registries.TINY_NICKEL_ORE, true).placementUniform(6, 0, 32, 4); + public static final OreConfig TINY_SILVER_ORE_CONFIG = new OreConfig(Registries.TINY_SILVER_ORE, true).placementUniform(6, -16, 28, 4); + public static final OreConfig TINY_TIN_ORE_CONFIG = new OreConfig(Registries.TINY_TIN_ORE, true).placementUniform(10, 0, 96, 6); + public static final OreConfig TINY_URANIUM_ORE_CONFIG = new OreConfig(Registries.TINY_URANIUM_ORE, true).placementUniform(6, -24, 28, 4); + private static final JsonConfigBuilder OVERWORLD_ORE_TINY_CONFIG = new JsonConfigBuilder("janoeo", "foundation", "overworld", "tiny"); + private static final JsonConfigBuilder OVERWORLD_ORE_CONFIG = new JsonConfigBuilder("janoeo", "foundation", "overworld"); public static void init() throws IOException { OVERWORLD_ORE_TINY_CONFIG.add(TINY_COAL_ORE_CONFIG).add(TINY_COPPER_ORE_CONFIG).add(TINY_DIAMOND_ORE_CONFIG).add(TINY_EMERALD_ORE_CONFIG) diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/config/OreConfig.java b/src/main/java/fr/alasdiablo/janoeo/foundation/config/OreConfig.java index 8e89e84..8d3f66c 100644 --- a/src/main/java/fr/alasdiablo/janoeo/foundation/config/OreConfig.java +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/config/OreConfig.java @@ -10,7 +10,6 @@ public class OreConfig extends JsonConfig { private String placement; private boolean enable; private int size; - private int range; private int count; private int bottom; private int top; @@ -20,20 +19,11 @@ public OreConfig(String name, boolean enable) { this.enable = enable; this.placement = ""; this.size = 0; - this.range = 0; this.count = 0; this.bottom = 0; this.top = 0; } - public OreConfig placementRange(int size, int range, int count) { - this.placement = "range"; - this.size = size; - this.range = range; - this.count = count; - return this; - } - public OreConfig placementTriangle(int size, int bottom, int top) { this.placement = "triangle"; this.size = size; @@ -59,17 +49,7 @@ protected void read(final JsonObject json) { this.placement = type.getAsString(); this.enable = enable.getAsBoolean(); switch (this.placement) { - case "range" -> { - this.size = placement.get("size").getAsInt(); - this.range = placement.get("range").getAsInt(); - this.count = placement.get("count").getAsInt(); - } - case "triangle" -> { - this.size = placement.get("size").getAsInt(); - this.bottom = placement.get("bottom").getAsInt(); - this.top = placement.get("top").getAsInt(); - } - case "uniform" -> { + case "triangle", "uniform" -> { this.size = placement.get("size").getAsInt(); this.bottom = placement.get("bottom").getAsInt(); this.top = placement.get("top").getAsInt(); @@ -82,21 +62,12 @@ protected void read(final JsonObject json) { @Override protected JsonObject write() { final JsonObject json = new JsonObject(); + json.addProperty("__comment", "Type: ['triangle', 'uniform']"); json.addProperty("type", this.placement); json.addProperty("enable", this.enable); final JsonObject placement = new JsonObject(); switch (this.placement) { - case "range" -> { - placement.addProperty("size", this.size); - placement.addProperty("range", this.range); - placement.addProperty("count", this.count); - } - case "triangle" -> { - placement.addProperty("size", this.size); - placement.addProperty("bottom", this.bottom); - placement.addProperty("top", this.top); - } - case "uniform" -> { + case "triangle", "uniform" -> { placement.addProperty("size", this.size); placement.addProperty("bottom", this.bottom); placement.addProperty("top", this.top); @@ -112,6 +83,10 @@ protected String getName() { return this.name; } + public String name() { + return this.name; + } + public String getPlacement() { return placement; } @@ -124,10 +99,6 @@ public int getSize() { return size; } - public int getRange() { - return range; - } - public int getCount() { return count; } diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/data/FoundationBlockStateProvider.java b/src/main/java/fr/alasdiablo/janoeo/foundation/data/FoundationBlockStateProvider.java index f4fba1e..f330877 100644 --- a/src/main/java/fr/alasdiablo/janoeo/foundation/data/FoundationBlockStateProvider.java +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/data/FoundationBlockStateProvider.java @@ -1,6 +1,6 @@ package fr.alasdiablo.janoeo.foundation.data; -import fr.alasdiablo.diolib.data.DioBlockStateProvider; +import fr.alasdiablo.diolib.data.provider.DioBlockStateProvider; import net.minecraft.data.DataGenerator; import java.util.Arrays; diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/data/FoundationLootTableProvider.java b/src/main/java/fr/alasdiablo/janoeo/foundation/data/FoundationLootTableProvider.java index 7092142..3cc0c47 100644 --- a/src/main/java/fr/alasdiablo/janoeo/foundation/data/FoundationLootTableProvider.java +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/data/FoundationLootTableProvider.java @@ -1,8 +1,7 @@ package fr.alasdiablo.janoeo.foundation.data; -import com.google.common.collect.ImmutableList; import com.mojang.datafixers.util.Pair; -import fr.alasdiablo.diolib.data.DioLootTableProvider; +import fr.alasdiablo.diolib.data.provider.DioLootTableProvider; import fr.alasdiablo.janoeo.foundation.Registries; import fr.alasdiablo.janoeo.foundation.data.loot.FoundationBlockLootTables; import net.minecraft.data.DataGenerator; @@ -10,11 +9,11 @@ public class FoundationLootTableProvider extends DioLootTableProvider { public FoundationLootTableProvider(DataGenerator dataGeneratorIn) { - super( - dataGeneratorIn, - ImmutableList.of(Pair.of(FoundationBlockLootTables::new, LootContextParamSets.BLOCK)), - LootContextParamSets.BLOCK, - Registries.MOD_ID - ); + super(dataGeneratorIn, Registries.MOD_ID); + } + + @Override + public void registerAdvancements() { + this.addLootTable(Pair.of(FoundationBlockLootTables::new, LootContextParamSets.BLOCK)); } } diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/data/language/FrenchProvider.java b/src/main/java/fr/alasdiablo/janoeo/foundation/data/language/FrenchProvider.java index bb9df71..2deddda 100644 --- a/src/main/java/fr/alasdiablo/janoeo/foundation/data/language/FrenchProvider.java +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/data/language/FrenchProvider.java @@ -1,6 +1,6 @@ package fr.alasdiablo.janoeo.foundation.data.language; -import fr.alasdiablo.diolib.util.SimpleUnicode; +import fr.alasdiablo.diolib.data.SimpleUnicode; import fr.alasdiablo.janoeo.foundation.Foundation; import fr.alasdiablo.janoeo.foundation.Registries; import net.minecraft.data.DataGenerator; diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/data/loot/FoundationBlockLootTables.java b/src/main/java/fr/alasdiablo/janoeo/foundation/data/loot/FoundationBlockLootTables.java index e499170..297adc0 100644 --- a/src/main/java/fr/alasdiablo/janoeo/foundation/data/loot/FoundationBlockLootTables.java +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/data/loot/FoundationBlockLootTables.java @@ -1,6 +1,6 @@ package fr.alasdiablo.janoeo.foundation.data.loot; -import fr.alasdiablo.diolib.data.DioBlockLootTables; +import fr.alasdiablo.diolib.data.loot.BlockLootTable; import fr.alasdiablo.janoeo.foundation.init.FoundationBlocks; import fr.alasdiablo.janoeo.foundation.init.FoundationItems; import net.minecraft.world.item.Item; @@ -16,7 +16,7 @@ import java.util.Arrays; -public class FoundationBlockLootTables extends DioBlockLootTables { +public class FoundationBlockLootTables extends BlockLootTable { @Override protected void addTables() { diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/init/FoundationBlocks.java b/src/main/java/fr/alasdiablo/janoeo/foundation/init/FoundationBlocks.java index 614c291..a63ca10 100644 --- a/src/main/java/fr/alasdiablo/janoeo/foundation/init/FoundationBlocks.java +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/init/FoundationBlocks.java @@ -1,7 +1,7 @@ package fr.alasdiablo.janoeo.foundation.init; -import fr.alasdiablo.diolib.generic.ExperienceRarity; -import fr.alasdiablo.diolib.util.RegistryHelper; +import fr.alasdiablo.diolib.block.ExperienceRarity; +import fr.alasdiablo.diolib.registries.RegistryHelper; import fr.alasdiablo.janoeo.foundation.Foundation; import fr.alasdiablo.janoeo.foundation.Registries; import fr.alasdiablo.janoeo.foundation.block.OreBlock; diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/init/FoundationGeneration.java b/src/main/java/fr/alasdiablo/janoeo/foundation/init/FoundationGeneration.java new file mode 100644 index 0000000..ea64ca0 --- /dev/null +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/init/FoundationGeneration.java @@ -0,0 +1,81 @@ +package fr.alasdiablo.janoeo.foundation.init; + +import fr.alasdiablo.janoeo.foundation.config.FoundationConfig; +import fr.alasdiablo.janoeo.foundation.worldgen.placement.FoundationPlacements; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.levelgen.GenerationStep; +import net.minecraftforge.event.world.BiomeLoadingEvent; + +public class FoundationGeneration { + + public static void onBiomeLoading(BiomeLoadingEvent biomeLoadingEvent) { + var generation = biomeLoadingEvent.getGeneration(); + + if (FoundationConfig.TINY_COAL_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_TINY_COAL + ); + if (FoundationConfig.TINY_COPPER_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_TINY_COPPER + ); + if (FoundationConfig.TINY_DIAMOND_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_TINY_DIAMOND + ); + if (FoundationConfig.TINY_EMERALD_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_TINY_EMERALD + ); + if (FoundationConfig.TINY_GOLD_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_TINY_GOLD + ); + if (FoundationConfig.TINY_GOLD_ORE_EXTRA_CONFIG.isEnable() + && biomeLoadingEvent.getCategory() == Biome.BiomeCategory.MESA) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_TINY_GOLD_EXTRA + ); + if (FoundationConfig.TINY_IRON_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_TINY_IRON + ); + if (FoundationConfig.TINY_LAPIS_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_TINY_LAPIS + ); + if (FoundationConfig.TINY_REDSTONE_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_TINY_REDSTONE + ); + + if (FoundationConfig.BAUXITE_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_BAUXITE + ); + if (FoundationConfig.LEAD_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_LEAD + ); + if (FoundationConfig.NICKEL_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_NICKEL + ); + if (FoundationConfig.SILVER_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_SILVER + ); + if (FoundationConfig.TIN_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_TIN + ); + if (FoundationConfig.URANIUM_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.ORE_URANIUM + ); + + if (FoundationConfig.TINY_BAUXITE_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.TINY_ORE_BAUXITE + ); + if (FoundationConfig.TINY_LEAD_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.TINY_ORE_LEAD + ); + if (FoundationConfig.TINY_NICKEL_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.TINY_ORE_NICKEL + ); + if (FoundationConfig.TINY_SILVER_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.TINY_ORE_SILVER + ); + if (FoundationConfig.TINY_TIN_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.TINY_ORE_TIN + ); + if (FoundationConfig.TINY_URANIUM_ORE_CONFIG.isEnable()) generation.addFeature( + GenerationStep.Decoration.UNDERGROUND_ORES, FoundationPlacements.TINY_ORE_URANIUM + ); + } +} diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/init/FoundationItems.java b/src/main/java/fr/alasdiablo/janoeo/foundation/init/FoundationItems.java index a7d561c..0f54a4a 100644 --- a/src/main/java/fr/alasdiablo/janoeo/foundation/init/FoundationItems.java +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/init/FoundationItems.java @@ -1,6 +1,6 @@ package fr.alasdiablo.janoeo.foundation.init; -import fr.alasdiablo.diolib.util.RegistryHelper; +import fr.alasdiablo.diolib.registries.RegistryHelper; import fr.alasdiablo.janoeo.foundation.Foundation; import fr.alasdiablo.janoeo.foundation.Registries; import net.minecraft.world.item.Item; diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/world/WorldGen.java b/src/main/java/fr/alasdiablo/janoeo/foundation/world/WorldGen.java deleted file mode 100644 index 4b862fa..0000000 --- a/src/main/java/fr/alasdiablo/janoeo/foundation/world/WorldGen.java +++ /dev/null @@ -1,85 +0,0 @@ -package fr.alasdiablo.janoeo.foundation.world; - -import fr.alasdiablo.diolib.world.WorldGenerationHelper; -import fr.alasdiablo.janoeo.foundation.config.FoundationConfig; -import fr.alasdiablo.janoeo.foundation.world.gen.FoundationFeatures; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.levelgen.GenerationStep; -import net.minecraftforge.registries.ForgeRegistries; - -public class WorldGen { - public static void init() { - for (Biome biome: ForgeRegistries.BIOMES) { - oreGen(biome); - } - } - - private static void oreGen(Biome biome) { - if (FoundationConfig.TINY_COAL_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_TINY_COAL, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.TINY_COPPER_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_TINY_COPPER, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.TINY_DIAMOND_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_TINY_DIAMOND, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.TINY_EMERALD_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_TINY_EMERALD, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.TINY_GOLD_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_TINY_GOLD, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.TINY_GOLD_ORE_EXTRA_CONFIG.isEnable() - && biome.getBiomeCategory() == Biome.BiomeCategory.MESA) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_TINY_GOLD_EXTRA, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.TINY_IRON_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_TINY_IRON, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.TINY_LAPIS_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_TINY_LAPIS, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.TINY_REDSTONE_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_TINY_REDSTONE, GenerationStep.Decoration.UNDERGROUND_ORES - ); - - if (FoundationConfig.BAUXITE_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_BAUXITE, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.LEAD_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_LEAD, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.NICKEL_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_NICKEL, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.SILVER_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_SILVER, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.TIN_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_TIN, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.URANIUM_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.ORE_URANIUM, GenerationStep.Decoration.UNDERGROUND_ORES - ); - - if (FoundationConfig.TINY_BAUXITE_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.TINY_ORE_BAUXITE, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.TINY_LEAD_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.TINY_ORE_LEAD, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.TINY_NICKEL_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.TINY_ORE_NICKEL, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.TINY_SILVER_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.TINY_ORE_SILVER, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.TINY_TIN_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.TINY_ORE_TIN, GenerationStep.Decoration.UNDERGROUND_ORES - ); - if (FoundationConfig.TINY_URANIUM_ORE_CONFIG.isEnable()) WorldGenerationHelper.addFeature( - biome, FoundationFeatures.TINY_ORE_URANIUM, GenerationStep.Decoration.UNDERGROUND_ORES - ); - } -} diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/world/gen/FoundationFeatures.java b/src/main/java/fr/alasdiablo/janoeo/foundation/world/gen/FoundationFeatures.java deleted file mode 100644 index ad225b5..0000000 --- a/src/main/java/fr/alasdiablo/janoeo/foundation/world/gen/FoundationFeatures.java +++ /dev/null @@ -1,222 +0,0 @@ -package fr.alasdiablo.janoeo.foundation.world.gen; - -import com.google.common.collect.ImmutableList; -import fr.alasdiablo.diolib.util.RegistryHelper; -import fr.alasdiablo.diolib.world.WorldGenerationHelper; -import fr.alasdiablo.janoeo.foundation.config.FoundationConfig; -import fr.alasdiablo.janoeo.foundation.config.OreConfig; -import fr.alasdiablo.janoeo.foundation.init.FoundationBlocks; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.levelgen.VerticalAnchor; -import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -import net.minecraft.world.level.levelgen.feature.Feature; -import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; -import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest; - -import java.util.Objects; - -@SuppressWarnings("unused") -public class FoundationFeatures { - - public static final ImmutableList ORE_TINY_COAL_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_COAL_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_COAL_ORE.defaultBlockState()) - ); - public static final ImmutableList ORE_TINY_COPPER_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_COPPER_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_COPPER_ORE.defaultBlockState()) - ); - public static final ImmutableList ORE_TINY_DIAMOND_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_DIAMOND_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_DIAMOND_ORE.defaultBlockState()) - ); - public static final ImmutableList ORE_TINY_EMERALD_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_EMERALD_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_EMERALD_ORE.defaultBlockState()) - ); - public static final ImmutableList ORE_TINY_GOLD_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_GOLD_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_GOLD_ORE.defaultBlockState()) - ); - public static final ImmutableList ORE_TINY_IRON_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_IRON_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_IRON_ORE.defaultBlockState()) - ); - public static final ImmutableList ORE_TINY_LAPIS_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_LAPIS_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_LAPIS_ORE.defaultBlockState()) - ); - public static final ImmutableList ORE_TINY_REDSTONE_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_REDSTONE_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_REDSTONE_ORE.defaultBlockState()) - ); - public static final ImmutableList ORE_BAUXITE_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.BAUXITE_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_BAUXITE_ORE.defaultBlockState()) - ); - public static final ImmutableList ORE_LEAD_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.LEAD_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_LEAD_ORE.defaultBlockState()) - ); - public static final ImmutableList ORE_NICKEL_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.NICKEL_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_NICKEL_ORE.defaultBlockState()) - ); - public static final ImmutableList ORE_SILVER_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.SILVER_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_SILVER_ORE.defaultBlockState()) - ); - public static final ImmutableList ORE_TIN_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TIN_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TIN_ORE.defaultBlockState()) - ); - public static final ImmutableList ORE_URANIUM_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.URANIUM_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_URANIUM_ORE.defaultBlockState()) - ); - public static final ImmutableList TINY_ORE_BAUXITE_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_BAUXITE_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_BAUXITE_ORE.defaultBlockState()) - ); - public static final ImmutableList TINY_ORE_LEAD_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_LEAD_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_LEAD_ORE.defaultBlockState()) - ); - public static final ImmutableList TINY_ORE_NICKEL_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_NICKEL_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_NICKEL_ORE.defaultBlockState()) - ); - public static final ImmutableList TINY_ORE_SILVER_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_SILVER_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_SILVER_ORE.defaultBlockState()) - ); - public static final ImmutableList TINY_ORE_TIN_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_TIN_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_TIN_ORE.defaultBlockState()) - ); - public static final ImmutableList TINY_ORE_URANIUM_LIST = ImmutableList.of( - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_URANIUM_ORE.defaultBlockState()), - OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_URANIUM_ORE.defaultBlockState()) - ); - public static final ConfiguredFeature ORE_TINY_COAL = createOreFeature(ORE_TINY_COAL_LIST, FoundationConfig.TINY_COAL_ORE_CONFIG); - public static final ConfiguredFeature ORE_TINY_COPPER = createOreFeature(ORE_TINY_COPPER_LIST, FoundationConfig.TINY_COPPER_ORE_CONFIG); - public static final ConfiguredFeature ORE_TINY_DIAMOND = createOreFeature(ORE_TINY_DIAMOND_LIST, FoundationConfig.TINY_DIAMOND_ORE_CONFIG); - public static final ConfiguredFeature ORE_TINY_EMERALD = createOreFeature(ORE_TINY_EMERALD_LIST, FoundationConfig.TINY_EMERALD_ORE_CONFIG); - public static final ConfiguredFeature ORE_TINY_GOLD = createOreFeature(ORE_TINY_GOLD_LIST, FoundationConfig.TINY_GOLD_ORE_CONFIG); - public static final ConfiguredFeature ORE_TINY_GOLD_EXTRA = createOreFeature(ORE_TINY_GOLD_LIST, FoundationConfig.TINY_GOLD_ORE_EXTRA_CONFIG); - public static final ConfiguredFeature ORE_TINY_IRON = createOreFeature(ORE_TINY_IRON_LIST, FoundationConfig.TINY_IRON_ORE_CONFIG); - public static final ConfiguredFeature ORE_TINY_LAPIS = createOreFeature(ORE_TINY_LAPIS_LIST, FoundationConfig.TINY_LAPIS_ORE_CONFIG); - public static final ConfiguredFeature ORE_TINY_REDSTONE = createOreFeature(ORE_TINY_REDSTONE_LIST, FoundationConfig.TINY_REDSTONE_ORE_CONFIG); - public static final ConfiguredFeature ORE_BAUXITE = createOreFeature(ORE_BAUXITE_LIST, FoundationConfig.BAUXITE_ORE_CONFIG); - public static final ConfiguredFeature ORE_LEAD = createOreFeature(ORE_LEAD_LIST, FoundationConfig.LEAD_ORE_CONFIG); - public static final ConfiguredFeature ORE_NICKEL = createOreFeature(ORE_NICKEL_LIST, FoundationConfig.NICKEL_ORE_CONFIG); - public static final ConfiguredFeature ORE_SILVER = createOreFeature(ORE_SILVER_LIST, FoundationConfig.SILVER_ORE_CONFIG); - public static final ConfiguredFeature ORE_TIN = createOreFeature(ORE_TIN_LIST, FoundationConfig.TIN_ORE_CONFIG); - public static final ConfiguredFeature ORE_URANIUM = createOreFeature(ORE_URANIUM_LIST, FoundationConfig.URANIUM_ORE_CONFIG); - public static final ConfiguredFeature TINY_ORE_BAUXITE = createOreFeature(TINY_ORE_BAUXITE_LIST, FoundationConfig.TINY_BAUXITE_ORE_CONFIG); - public static final ConfiguredFeature TINY_ORE_LEAD = createOreFeature(TINY_ORE_LEAD_LIST, FoundationConfig.TINY_LEAD_ORE_CONFIG); - public static final ConfiguredFeature TINY_ORE_NICKEL = createOreFeature(TINY_ORE_NICKEL_LIST, FoundationConfig.TINY_NICKEL_ORE_CONFIG); - public static final ConfiguredFeature TINY_ORE_SILVER = createOreFeature(TINY_ORE_SILVER_LIST, FoundationConfig.TINY_SILVER_ORE_CONFIG); - public static final ConfiguredFeature TINY_ORE_TIN = createOreFeature(TINY_ORE_TIN_LIST, FoundationConfig.TINY_TIN_ORE_CONFIG); - public static final ConfiguredFeature TINY_ORE_URANIUM = createOreFeature(TINY_ORE_URANIUM_LIST, FoundationConfig.TINY_URANIUM_ORE_CONFIG); - - private static ConfiguredFeature createOreFeature(Block block, RuleTest target, OreConfig config) { - switch (config.getPlacement()) { - case "range" -> { - return Feature.ORE.configured( - new OreConfiguration(target, block.defaultBlockState(), config.getSize()) - ).rangeUniform( - VerticalAnchor.bottom(), - VerticalAnchor.absolute(config.getRange()) - ).squared().count(config.getCount()); - } - case "triangle" -> { - return Feature.ORE.configured( - new OreConfiguration(target, block.defaultBlockState(), config.getSize()) - ).rangeTriangle( - VerticalAnchor.absolute(config.getBottom()), - VerticalAnchor.absolute(config.getTop()) - ).squared(); - } - case "uniform" -> { - return Feature.ORE.configured( - new OreConfiguration(target, block.defaultBlockState(), config.getSize()) - ).rangeUniform( - VerticalAnchor.absolute(config.getBottom()), - VerticalAnchor.absolute(config.getTop()) - ).squared().count(config.getCount()); - } - } - throw new IllegalStateException("Undefined placement type"); - } - - private static ConfiguredFeature createOreFeature(ImmutableList target, OreConfig config) { - switch (config.getPlacement()) { - case "range" -> { - return Feature.ORE.configured( - new OreConfiguration(target, config.getSize()) - ).rangeUniform( - VerticalAnchor.bottom(), - VerticalAnchor.absolute(config.getRange()) - ).squared().count(config.getCount()); - } - case "triangle" -> { - return Feature.ORE.configured( - new OreConfiguration(target, config.getSize()) - ).rangeTriangle( - VerticalAnchor.absolute(config.getBottom()), - VerticalAnchor.absolute(config.getTop()) - ).squared(); - } - case "uniform" -> { - return Feature.ORE.configured( - new OreConfiguration(target, config.getSize()) - ).rangeUniform( - VerticalAnchor.absolute(config.getBottom()), - VerticalAnchor.absolute(config.getTop()) - ).squared().count(config.getCount()); - } - } - throw new IllegalStateException("Undefined placement type"); - } - - private static void register(Block block, ConfiguredFeature configuredFeature) { - WorldGenerationHelper.ConfiguredFeatureHelper.register( - Objects.requireNonNull(block.getRegistryName()), configuredFeature - ); - } - - private static void register(Block block, String prefix, ConfiguredFeature configuredFeature) { - WorldGenerationHelper.ConfiguredFeatureHelper.register( - Objects.requireNonNull( - RegistryHelper.setPrefixOnRegistryName(block.getRegistryName(), prefix) - ), configuredFeature - ); - } - - public static void init() { - register(FoundationBlocks.TINY_COAL_ORE, ORE_TINY_COAL); - register(FoundationBlocks.TINY_COPPER_ORE, ORE_TINY_COPPER); - register(FoundationBlocks.TINY_DIAMOND_ORE, ORE_TINY_DIAMOND); - register(FoundationBlocks.TINY_EMERALD_ORE, ORE_TINY_EMERALD); - register(FoundationBlocks.TINY_GOLD_ORE, ORE_TINY_GOLD); - register(FoundationBlocks.TINY_GOLD_ORE, "extra", ORE_TINY_GOLD_EXTRA); - register(FoundationBlocks.TINY_IRON_ORE, ORE_TINY_IRON); - register(FoundationBlocks.TINY_LAPIS_ORE, ORE_TINY_LAPIS); - register(FoundationBlocks.TINY_REDSTONE_ORE, ORE_TINY_REDSTONE); - - register(FoundationBlocks.BAUXITE_ORE, ORE_BAUXITE); - register(FoundationBlocks.LEAD_ORE, ORE_LEAD); - register(FoundationBlocks.NICKEL_ORE, ORE_NICKEL); - register(FoundationBlocks.SILVER_ORE, ORE_SILVER); - register(FoundationBlocks.TIN_ORE, ORE_TIN); - register(FoundationBlocks.URANIUM_ORE, ORE_URANIUM); - - register(FoundationBlocks.TINY_BAUXITE_ORE, TINY_ORE_BAUXITE); - register(FoundationBlocks.TINY_LEAD_ORE, TINY_ORE_LEAD); - register(FoundationBlocks.TINY_NICKEL_ORE, TINY_ORE_NICKEL); - register(FoundationBlocks.TINY_SILVER_ORE, TINY_ORE_SILVER); - register(FoundationBlocks.TINY_TIN_ORE, TINY_ORE_TIN); - register(FoundationBlocks.TINY_URANIUM_ORE, TINY_ORE_URANIUM); - } -} diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/worldgen/features/FoundationFeatures.java b/src/main/java/fr/alasdiablo/janoeo/foundation/worldgen/features/FoundationFeatures.java new file mode 100644 index 0000000..aed6343 --- /dev/null +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/worldgen/features/FoundationFeatures.java @@ -0,0 +1,127 @@ +package fr.alasdiablo.janoeo.foundation.worldgen.features; + +import fr.alasdiablo.diolib.registries.RegistryHelper; +import fr.alasdiablo.janoeo.foundation.Registries; +import fr.alasdiablo.janoeo.foundation.config.FoundationConfig; +import fr.alasdiablo.janoeo.foundation.config.OreConfig; +import fr.alasdiablo.janoeo.foundation.init.FoundationBlocks; +import net.minecraft.data.worldgen.features.FeatureUtils; +import net.minecraft.data.worldgen.features.OreFeatures; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.level.levelgen.feature.Feature; +import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; + +import java.util.List; + +public class FoundationFeatures { + public static final List ORE_TINY_COAL_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_COAL_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_COAL_ORE.defaultBlockState()) + ); + public static final List ORE_TINY_COPPER_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_COPPER_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_COPPER_ORE.defaultBlockState()) + ); + public static final List ORE_TINY_DIAMOND_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_DIAMOND_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_DIAMOND_ORE.defaultBlockState()) + ); + public static final List ORE_TINY_EMERALD_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_EMERALD_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_EMERALD_ORE.defaultBlockState()) + ); + public static final List ORE_TINY_GOLD_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_GOLD_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_GOLD_ORE.defaultBlockState()) + ); + public static final List ORE_TINY_IRON_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_IRON_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_IRON_ORE.defaultBlockState()) + ); + public static final List ORE_TINY_LAPIS_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_LAPIS_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_LAPIS_ORE.defaultBlockState()) + ); + public static final List ORE_TINY_REDSTONE_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_REDSTONE_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_REDSTONE_ORE.defaultBlockState()) + ); + public static final List ORE_BAUXITE_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.BAUXITE_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_BAUXITE_ORE.defaultBlockState()) + ); + public static final List ORE_LEAD_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.LEAD_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_LEAD_ORE.defaultBlockState()) + ); + public static final List ORE_NICKEL_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.NICKEL_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_NICKEL_ORE.defaultBlockState()) + ); + public static final List ORE_SILVER_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.SILVER_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_SILVER_ORE.defaultBlockState()) + ); + public static final List ORE_TIN_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TIN_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TIN_ORE.defaultBlockState()) + ); + public static final List ORE_URANIUM_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.URANIUM_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_URANIUM_ORE.defaultBlockState()) + ); + public static final List TINY_ORE_BAUXITE_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_BAUXITE_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_BAUXITE_ORE.defaultBlockState()) + ); + public static final List TINY_ORE_LEAD_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_LEAD_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_LEAD_ORE.defaultBlockState()) + ); + public static final List TINY_ORE_NICKEL_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_NICKEL_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_NICKEL_ORE.defaultBlockState()) + ); + public static final List TINY_ORE_SILVER_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_SILVER_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_SILVER_ORE.defaultBlockState()) + ); + public static final List TINY_ORE_TIN_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_TIN_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_TIN_ORE.defaultBlockState()) + ); + public static final List TINY_ORE_URANIUM_TARGET_LIST = List.of( + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, FoundationBlocks.TINY_URANIUM_ORE.defaultBlockState()), + OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, FoundationBlocks.DEEPSLATE_TINY_URANIUM_ORE.defaultBlockState()) + ); + + public static final ConfiguredFeature ORE_TINY_COAL = createOreFeature(ORE_TINY_COAL_TARGET_LIST, FoundationConfig.TINY_COAL_ORE_CONFIG); + public static final ConfiguredFeature ORE_TINY_COPPER = createOreFeature(ORE_TINY_COPPER_TARGET_LIST, FoundationConfig.TINY_COPPER_ORE_CONFIG); + public static final ConfiguredFeature ORE_TINY_DIAMOND = createOreFeature(ORE_TINY_DIAMOND_TARGET_LIST, FoundationConfig.TINY_DIAMOND_ORE_CONFIG); + public static final ConfiguredFeature ORE_TINY_EMERALD = createOreFeature(ORE_TINY_EMERALD_TARGET_LIST, FoundationConfig.TINY_EMERALD_ORE_CONFIG); + public static final ConfiguredFeature ORE_TINY_GOLD = createOreFeature(ORE_TINY_GOLD_TARGET_LIST, FoundationConfig.TINY_GOLD_ORE_CONFIG); + public static final ConfiguredFeature ORE_TINY_GOLD_EXTRA = createOreFeature(ORE_TINY_GOLD_TARGET_LIST, FoundationConfig.TINY_GOLD_ORE_EXTRA_CONFIG); + public static final ConfiguredFeature ORE_TINY_IRON = createOreFeature(ORE_TINY_IRON_TARGET_LIST, FoundationConfig.TINY_IRON_ORE_CONFIG); + public static final ConfiguredFeature ORE_TINY_LAPIS = createOreFeature(ORE_TINY_LAPIS_TARGET_LIST, FoundationConfig.TINY_LAPIS_ORE_CONFIG); + public static final ConfiguredFeature ORE_TINY_REDSTONE = createOreFeature( + ORE_TINY_REDSTONE_TARGET_LIST, FoundationConfig.TINY_REDSTONE_ORE_CONFIG); + public static final ConfiguredFeature ORE_BAUXITE = createOreFeature(ORE_BAUXITE_TARGET_LIST, FoundationConfig.BAUXITE_ORE_CONFIG); + public static final ConfiguredFeature ORE_LEAD = createOreFeature(ORE_LEAD_TARGET_LIST, FoundationConfig.LEAD_ORE_CONFIG); + public static final ConfiguredFeature ORE_NICKEL = createOreFeature(ORE_NICKEL_TARGET_LIST, FoundationConfig.NICKEL_ORE_CONFIG); + public static final ConfiguredFeature ORE_SILVER = createOreFeature(ORE_SILVER_TARGET_LIST, FoundationConfig.SILVER_ORE_CONFIG); + public static final ConfiguredFeature ORE_TIN = createOreFeature(ORE_TIN_TARGET_LIST, FoundationConfig.TIN_ORE_CONFIG); + public static final ConfiguredFeature ORE_URANIUM = createOreFeature(ORE_URANIUM_TARGET_LIST, FoundationConfig.URANIUM_ORE_CONFIG); + public static final ConfiguredFeature TINY_ORE_BAUXITE = createOreFeature(TINY_ORE_BAUXITE_TARGET_LIST, FoundationConfig.TINY_BAUXITE_ORE_CONFIG); + public static final ConfiguredFeature TINY_ORE_LEAD = createOreFeature(TINY_ORE_LEAD_TARGET_LIST, FoundationConfig.TINY_LEAD_ORE_CONFIG); + public static final ConfiguredFeature TINY_ORE_NICKEL = createOreFeature(TINY_ORE_NICKEL_TARGET_LIST, FoundationConfig.TINY_NICKEL_ORE_CONFIG); + public static final ConfiguredFeature TINY_ORE_SILVER = createOreFeature(TINY_ORE_SILVER_TARGET_LIST, FoundationConfig.TINY_SILVER_ORE_CONFIG); + public static final ConfiguredFeature TINY_ORE_TIN = createOreFeature(TINY_ORE_TIN_TARGET_LIST, FoundationConfig.TINY_TIN_ORE_CONFIG); + public static final ConfiguredFeature TINY_ORE_URANIUM = createOreFeature(TINY_ORE_URANIUM_TARGET_LIST, FoundationConfig.TINY_URANIUM_ORE_CONFIG); + + private static ConfiguredFeature createOreFeature(List targetList, OreConfig oreConfig) { + return FeatureUtils.register( + RegistryHelper.rl(Registries.MOD_ID, oreConfig.name()).toString(), + Feature.ORE.configured(new OreConfiguration(targetList, oreConfig.getSize())) + ); + } +} diff --git a/src/main/java/fr/alasdiablo/janoeo/foundation/worldgen/placement/FoundationPlacements.java b/src/main/java/fr/alasdiablo/janoeo/foundation/worldgen/placement/FoundationPlacements.java new file mode 100644 index 0000000..26756b9 --- /dev/null +++ b/src/main/java/fr/alasdiablo/janoeo/foundation/worldgen/placement/FoundationPlacements.java @@ -0,0 +1,63 @@ +package fr.alasdiablo.janoeo.foundation.worldgen.placement; + +import fr.alasdiablo.diolib.registries.RegistryHelper; +import fr.alasdiablo.janoeo.foundation.Registries; +import fr.alasdiablo.janoeo.foundation.config.FoundationConfig; +import fr.alasdiablo.janoeo.foundation.config.OreConfig; +import fr.alasdiablo.janoeo.foundation.worldgen.features.FoundationFeatures; +import net.minecraft.data.worldgen.placement.PlacementUtils; +import net.minecraft.world.level.levelgen.VerticalAnchor; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.level.levelgen.placement.*; + +import java.util.List; + +public class FoundationPlacements { + public static final PlacedFeature ORE_TINY_COAL = createPlacedFeature(FoundationFeatures.ORE_TINY_COAL, FoundationConfig.TINY_COAL_ORE_CONFIG); + public static final PlacedFeature ORE_TINY_COPPER = createPlacedFeature(FoundationFeatures.ORE_TINY_COPPER, FoundationConfig.TINY_COPPER_ORE_CONFIG); + public static final PlacedFeature ORE_TINY_DIAMOND = createPlacedFeature(FoundationFeatures.ORE_TINY_DIAMOND, FoundationConfig.TINY_DIAMOND_ORE_CONFIG); + public static final PlacedFeature ORE_TINY_EMERALD = createPlacedFeature(FoundationFeatures.ORE_TINY_EMERALD, FoundationConfig.TINY_EMERALD_ORE_CONFIG); + public static final PlacedFeature ORE_TINY_GOLD = createPlacedFeature(FoundationFeatures.ORE_TINY_GOLD, FoundationConfig.TINY_GOLD_ORE_CONFIG); + public static final PlacedFeature ORE_TINY_GOLD_EXTRA = createPlacedFeature( + FoundationFeatures.ORE_TINY_GOLD_EXTRA, FoundationConfig.TINY_GOLD_ORE_EXTRA_CONFIG); + public static final PlacedFeature ORE_TINY_IRON = createPlacedFeature(FoundationFeatures.ORE_TINY_IRON, FoundationConfig.TINY_IRON_ORE_CONFIG); + public static final PlacedFeature ORE_TINY_LAPIS = createPlacedFeature(FoundationFeatures.ORE_TINY_LAPIS, FoundationConfig.TINY_LAPIS_ORE_CONFIG); + public static final PlacedFeature ORE_TINY_REDSTONE = createPlacedFeature( + FoundationFeatures.ORE_TINY_REDSTONE, FoundationConfig.TINY_REDSTONE_ORE_CONFIG); + public static final PlacedFeature ORE_BAUXITE = createPlacedFeature(FoundationFeatures.ORE_BAUXITE, FoundationConfig.BAUXITE_ORE_CONFIG); + public static final PlacedFeature ORE_LEAD = createPlacedFeature(FoundationFeatures.ORE_LEAD, FoundationConfig.LEAD_ORE_CONFIG); + public static final PlacedFeature ORE_NICKEL = createPlacedFeature(FoundationFeatures.ORE_NICKEL, FoundationConfig.NICKEL_ORE_CONFIG); + public static final PlacedFeature ORE_SILVER = createPlacedFeature(FoundationFeatures.ORE_SILVER, FoundationConfig.SILVER_ORE_CONFIG); + public static final PlacedFeature ORE_TIN = createPlacedFeature(FoundationFeatures.ORE_TIN, FoundationConfig.TIN_ORE_CONFIG); + public static final PlacedFeature ORE_URANIUM = createPlacedFeature(FoundationFeatures.ORE_URANIUM, FoundationConfig.URANIUM_ORE_CONFIG); + public static final PlacedFeature TINY_ORE_BAUXITE = createPlacedFeature(FoundationFeatures.TINY_ORE_BAUXITE, FoundationConfig.TINY_BAUXITE_ORE_CONFIG); + public static final PlacedFeature TINY_ORE_LEAD = createPlacedFeature(FoundationFeatures.TINY_ORE_LEAD, FoundationConfig.TINY_LEAD_ORE_CONFIG); + public static final PlacedFeature TINY_ORE_NICKEL = createPlacedFeature(FoundationFeatures.TINY_ORE_NICKEL, FoundationConfig.TINY_NICKEL_ORE_CONFIG); + public static final PlacedFeature TINY_ORE_SILVER = createPlacedFeature(FoundationFeatures.TINY_ORE_SILVER, FoundationConfig.TINY_SILVER_ORE_CONFIG); + public static final PlacedFeature TINY_ORE_TIN = createPlacedFeature(FoundationFeatures.TINY_ORE_TIN, FoundationConfig.TINY_TIN_ORE_CONFIG); + public static final PlacedFeature TINY_ORE_URANIUM = createPlacedFeature(FoundationFeatures.TINY_ORE_URANIUM, FoundationConfig.TINY_URANIUM_ORE_CONFIG); + + private static PlacedFeature createPlacedFeature(ConfiguredFeature target, OreConfig config) { + PlacedFeature placedFeature = switch (config.getPlacement()) { + case "triangle" -> target.placed(commonOrePlacement(config.getCount(), HeightRangePlacement.triangle( + VerticalAnchor.absolute(config.getBottom()), + VerticalAnchor.absolute(config.getTop()) + ))); + case "uniform" -> target.placed(commonOrePlacement(config.getCount(), HeightRangePlacement.uniform( + VerticalAnchor.absolute(config.getBottom()), + VerticalAnchor.absolute(config.getTop()) + ))); + default -> throw new IllegalStateException("Undefined placement type"); + }; + + return PlacementUtils.register(RegistryHelper.rl(Registries.MOD_ID, config.name()).toString(), placedFeature); + } + + private static List orePlacement(PlacementModifier count, PlacementModifier heightRange) { + return List.of(count, InSquarePlacement.spread(), heightRange, BiomeFilter.biome()); + } + + private static List commonOrePlacement(int count, PlacementModifier heightRange) { + return orePlacement(CountPlacement.of(count), heightRange); + } +} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 7b7c3b0..4587cbf 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,39 +1,36 @@ -modLoader="javafml" -loaderVersion="[37,)" -license = "LGPL-3.0" +modLoader = "javafml" +loaderVersion = "[39,)" +license = "LGPL-3.0 License" issueTrackerURL = "https://github.com/Janoeo/Foundation/issues" - [[mods]] - modId="janoeo_foundation" - version="${file.jarVersion}" - displayName="Janoeo Foundation" - logoFile="janoeo_foundation.png" - itemIcon="janoeo_foundation:iron_dust" - displayURL="https://www.curseforge.com/minecraft/mc-mods/janoeo" - authors="AlasDiablo, lIotaMiu and Safyrus" - description=''' -Janoeo Project Mod -Mod content: -- Ore generation +modId = "janoeo_foundation" +version = "${file.jarVersion}" +displayName = "Janoeo Foundation" +displayURL = "https://www.curseforge.com/minecraft/mc-mods/janoeo" +logoFile = "janoeo_foundation.png" +itemIcon = "janoeo_foundation:iron_dust" +authors = "AlasDiablo, Safyrus" +description = ''' +This mod a lot of ore type and more! ''' [[dependencies.janoeo_foundation]] - modId="forge" - mandatory=true - versionRange="[37,)" - ordering="NONE" - side="BOTH" +modId = "forge" +mandatory = true +versionRange = "[39,)" +ordering = "NONE" +side = "BOTH" [[dependencies.janoeo_foundation]] - modId = "minecraft" - mandatory = true - versionRange = "[1.17.1,1.18)" - ordering = "NONE" - side = "BOTH" +modId = "minecraft" +mandatory = true +versionRange = "[1.18.1,1.19)" +ordering = "NONE" +side = "BOTH" [[dependencies.janoeo_foundation]] - modId = "jeresources" - mandatory = false - versionRange = "[0.13.0.130,)" - ordering = "AFTER" - side = "BOTH" \ No newline at end of file +modId = "diolib" +mandatory = true +versionRange = "[3.0.19,)" +ordering = "NONE" +side = "BOTH" diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index b2f5158..6cd850d 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,7 +1,6 @@ { "pack": { - "description": "janoeo foundation resources", - "pack_format": 6, - "_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods." + "description": "Janoeo foundation resources", + "pack_format": 8 } }