diff --git a/CHANGELOG.md b/CHANGELOG.md index 66328ccb..1cd46eb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [1.20.1-1.0.2] - 2023-9-3 + +### Improved worlgen + ## [1.20.1-1.0.1] - 2023-8-30 ### Added amethyst tools. diff --git a/README.md b/README.md index 2fc0d383..25cb33c6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Armour and Tools Mod -![Long Term Support](https://img.shields.io/badge/Long_Term_Support-1.19.4-green) -![Short Term Support](https://img.shields.io/badge/Short_Term_Support-1.20.1-green) +![Long Term Support](https://img.shields.io/badge/Long_Term_Support-1.20.1-green) +![Short Term Support](https://img.shields.io/badge/Short_Term_Support-1.19.4-green) [![](http://cf.way2muchnoise.eu/480779.svg)](https://www.curseforge.com/minecraft/mc-mods/armour-and-items-mod) [![](http://cf.way2muchnoise.eu/versions/480779.svg)](https://www.curseforge.com/minecraft/mc-mods/armour-and-items-mod) [![License: Apache License](https://img.shields.io/badge/License-Apache_License-blue.svg)](https://opensource.org/licenses/Apache-2.0) diff --git a/build.gradle.kts b/build.gradle.kts index ca78583b..95faab5b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,7 +21,7 @@ plugins { project.group = "io.github.realyusufismail" -project.version = "1.20.1-1.0.1" +project.version = "1.20.1-1.0.2" base.archivesName.set("armourandtoolsmod") diff --git a/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 b/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 index 397fd0ff..69b04235 100644 --- a/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 +++ b/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 @@ -1,13 +1,13 @@ -// 1.20.1 2023-08-28T05:16:02.6283281 Registries -dff220c6252072f47de109d9b043436b066ac2bd data/armourandtoolsmod/worldgen/configured_feature/aqumarine_ore.json -7c90240b4f84b84a5e0e4afd9f48d16d655236a7 data/armourandtoolsmod/worldgen/configured_feature/enderite_ore.json -5c862835bad5b578878f8c5e3329d0326c14be59 data/armourandtoolsmod/worldgen/configured_feature/graphite_ore.json -823f07ee2f8283861d91c55861d7afed75ef296d data/armourandtoolsmod/worldgen/configured_feature/rainbow_ore.json -335f86fd803d6396b194ec4ee84cae932de1444d data/armourandtoolsmod/worldgen/configured_feature/ruby_ore.json -1dc46b76902ac7f09671de5c38770d262cff1da7 data/armourandtoolsmod/worldgen/configured_feature/sapphire_ore.json -08a77d00c1c44908fd3d8dad274657cbee9def41 data/armourandtoolsmod/worldgen/placed_feature/aqumarine_ore.json -9090d341fcc02fe1967f84afb9b817be6b349fa2 data/armourandtoolsmod/worldgen/placed_feature/enderite_ore.json -1c4d086a91063ea79abe970d015f6857f024654d data/armourandtoolsmod/worldgen/placed_feature/graphite_ore.json -17e52da381098508af265bf7cac32a88a9a014a5 data/armourandtoolsmod/worldgen/placed_feature/rainbow_ore.json +// 1.20.1 2023-09-03T09:44:53.454996 Registries +8ebeb9bcc133ba172a3775d0e796bc03967d305e data/armourandtoolsmod/worldgen/configured_feature/aqumarine_ore.json +efcff90a0c2ce2de5ad73b08e38af0880ff404de data/armourandtoolsmod/worldgen/configured_feature/enderite_ore.json +b77f5a337f5557cc75c6aa6e358f59b658ba914c data/armourandtoolsmod/worldgen/configured_feature/graphite_ore.json +b6141dbad16c493a2dd3da977a099762593c0ce1 data/armourandtoolsmod/worldgen/configured_feature/rainbow_ore.json +3057438b0a0e49c8fa64f17eca031307d1247594 data/armourandtoolsmod/worldgen/configured_feature/ruby_ore.json +ae5ee97a8e0db56c8b686c63d73efad162974df7 data/armourandtoolsmod/worldgen/configured_feature/sapphire_ore.json +f27642c578ca288c102d5a06421fcd879102fd7a data/armourandtoolsmod/worldgen/placed_feature/aqumarine_ore.json +a0c79f9bf1ba7248cab71480bb71041682400cdd data/armourandtoolsmod/worldgen/placed_feature/enderite_ore.json +65608a650f79607aeb96f0ad3ed9a099f59aec67 data/armourandtoolsmod/worldgen/placed_feature/graphite_ore.json +c784f4c858f7b80fcc27ca88c8f80774bfa35b23 data/armourandtoolsmod/worldgen/placed_feature/rainbow_ore.json 7bb425cc1128f1c7cce61f9ef23b30e7bf3b3331 data/armourandtoolsmod/worldgen/placed_feature/ruby_ore.json -8bf13772a1d018ab66fbb68e9bbd8401a67a6495 data/armourandtoolsmod/worldgen/placed_feature/sapphire_ore.json +ed58618a3af3d63c835c2a5dccff501b8272f323 data/armourandtoolsmod/worldgen/placed_feature/sapphire_ore.json diff --git a/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/aqumarine_ore.json b/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/aqumarine_ore.json index 8dee297d..7504b6ec 100644 --- a/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/aqumarine_ore.json +++ b/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/aqumarine_ore.json @@ -2,7 +2,7 @@ "type": "minecraft:ore", "config": { "discard_chance_on_air_exposure": 0.0, - "size": 2, + "size": 4, "targets": [ { "state": { @@ -15,7 +15,7 @@ }, { "state": { - "Name": "armourandtoolsmod:graphite_ore" + "Name": "armourandtoolsmod:deepslate_aqumarine_ore" }, "target": { "predicate_type": "minecraft:tag_match", diff --git a/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/enderite_ore.json b/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/enderite_ore.json index 2be688fa..040c27b8 100644 --- a/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/enderite_ore.json +++ b/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/enderite_ore.json @@ -2,7 +2,7 @@ "type": "minecraft:ore", "config": { "discard_chance_on_air_exposure": 0.0, - "size": 2, + "size": 4, "targets": [ { "state": { diff --git a/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/graphite_ore.json b/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/graphite_ore.json index 6991003d..200ec846 100644 --- a/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/graphite_ore.json +++ b/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/graphite_ore.json @@ -2,7 +2,7 @@ "type": "minecraft:ore", "config": { "discard_chance_on_air_exposure": 0.0, - "size": 6, + "size": 4, "targets": [ { "state": { @@ -15,7 +15,7 @@ }, { "state": { - "Name": "armourandtoolsmod:aqumarine_ore" + "Name": "armourandtoolsmod:deepslate_graphite_ore" }, "target": { "predicate_type": "minecraft:tag_match", diff --git a/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/rainbow_ore.json b/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/rainbow_ore.json index ffec8f2b..481d7565 100644 --- a/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/rainbow_ore.json +++ b/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/rainbow_ore.json @@ -2,7 +2,7 @@ "type": "minecraft:ore", "config": { "discard_chance_on_air_exposure": 0.0, - "size": 2, + "size": 3, "targets": [ { "state": { @@ -18,7 +18,7 @@ }, { "state": { - "Name": "armourandtoolsmod:rainbow_ore", + "Name": "armourandtoolsmod:deepslate_rainbow_ore", "Properties": { "lit": "false" } diff --git a/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/ruby_ore.json b/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/ruby_ore.json index 58ef0c6b..a5d3a45c 100644 --- a/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/ruby_ore.json +++ b/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/ruby_ore.json @@ -2,7 +2,7 @@ "type": "minecraft:ore", "config": { "discard_chance_on_air_exposure": 0.0, - "size": 6, + "size": 4, "targets": [ { "state": { @@ -18,7 +18,10 @@ }, { "state": { - "Name": "armourandtoolsmod:sapphire_ore" + "Name": "armourandtoolsmod:deepslate_ruby_ore", + "Properties": { + "lit": "false" + } }, "target": { "predicate_type": "minecraft:tag_match", diff --git a/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/sapphire_ore.json b/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/sapphire_ore.json index a863aee4..30d35943 100644 --- a/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/sapphire_ore.json +++ b/src/generated/resources/data/armourandtoolsmod/worldgen/configured_feature/sapphire_ore.json @@ -15,10 +15,7 @@ }, { "state": { - "Name": "armourandtoolsmod:ruby_ore", - "Properties": { - "lit": "false" - } + "Name": "armourandtoolsmod:deepslate_sapphire_ore" }, "target": { "predicate_type": "minecraft:tag_match", diff --git a/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/aqumarine_ore.json b/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/aqumarine_ore.json index f8961b81..e9630645 100644 --- a/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/aqumarine_ore.json +++ b/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/aqumarine_ore.json @@ -13,7 +13,7 @@ "height": { "type": "minecraft:uniform", "max_inclusive": { - "absolute": -20 + "absolute": 40 }, "min_inclusive": { "absolute": -64 diff --git a/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/enderite_ore.json b/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/enderite_ore.json index e85c998b..12e1276a 100644 --- a/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/enderite_ore.json +++ b/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/enderite_ore.json @@ -13,10 +13,10 @@ "height": { "type": "minecraft:uniform", "max_inclusive": { - "absolute": 32 + "absolute": 40 }, "min_inclusive": { - "absolute": 2 + "absolute": -64 } } }, diff --git a/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/graphite_ore.json b/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/graphite_ore.json index cef08918..07cc1ed4 100644 --- a/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/graphite_ore.json +++ b/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/graphite_ore.json @@ -13,7 +13,7 @@ "height": { "type": "minecraft:uniform", "max_inclusive": { - "absolute": 10 + "absolute": 30 }, "min_inclusive": { "absolute": -64 diff --git a/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/rainbow_ore.json b/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/rainbow_ore.json index 9e5fc7f7..39eb0931 100644 --- a/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/rainbow_ore.json +++ b/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/rainbow_ore.json @@ -13,7 +13,7 @@ "height": { "type": "minecraft:uniform", "max_inclusive": { - "absolute": -20 + "absolute": 40 }, "min_inclusive": { "absolute": -64 diff --git a/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/sapphire_ore.json b/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/sapphire_ore.json index 6f242794..e0797318 100644 --- a/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/sapphire_ore.json +++ b/src/generated/resources/data/armourandtoolsmod/worldgen/placed_feature/sapphire_ore.json @@ -13,7 +13,7 @@ "height": { "type": "minecraft:uniform", "max_inclusive": { - "absolute": 10 + "absolute": 20 }, "min_inclusive": { "absolute": -64 diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/DataGenerators.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/DataGenerators.kt index 936d9f3b..e3e86c8a 100644 --- a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/DataGenerators.kt +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/DataGenerators.kt @@ -27,7 +27,7 @@ import io.github.realyusufismail.armourandtoolsmod.datagen.tags.ModBlockTagsProv import io.github.realyusufismail.armourandtoolsmod.datagen.tags.ModItemTagsProvider import io.github.realyusufismail.armourandtoolsmod.datagen.texture.ModBlockStateProvider import io.github.realyusufismail.armourandtoolsmod.datagen.texture.ModItemStateProvider -import io.github.realyusufismail.armourandtoolsmod.datagen.world.ModWorldGenerationProvider +import io.github.realyusufismail.armourandtoolsmod.datagen.world.ModWorldGenProvider import java.util.* import java.util.function.Function import java.util.stream.Collectors @@ -61,7 +61,7 @@ object DataGenerators { gen.addProvider(true, blockTag) gen.addProvider(true, ModItemTagsProvider(gen, existingFileHelper, blockTag, lookup)) gen.addProvider(true, MainModRecipeProvider(gen)) - gen.addProvider(true, ModWorldGenerationProvider(gen.packOutput, lookup)) + gen.addProvider(true, ModWorldGenProvider(gen.packOutput, lookup)) gen.addProvider( true, ArmourAndTollsModSpriteSourceProvider(gen.packOutput, existingFileHelper)) diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/world/ModOreFeaturesGen.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/world/ModOreFeaturesGen.kt deleted file mode 100644 index 2ce940e4..00000000 --- a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/world/ModOreFeaturesGen.kt +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2022 RealYusufIsmail. - * - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * - * you may not use this file except in compliance with the License. - * - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.github.realyusufismail.armourandtoolsmod.datagen.world - -import io.github.realyusufismail.armourandtoolsmod.ArmourAndToolsMod.ArmorAndToolsMod.getModIdAndName -import io.github.realyusufismail.armourandtoolsmod.core.init.BlockInit -import io.github.realyusufismail.realyusufismailcore.data.support.oregen.ModOreFeaturesSupport -import net.minecraft.core.registries.Registries -import net.minecraft.data.worldgen.BootstapContext -import net.minecraft.resources.ResourceKey -import net.minecraft.world.level.block.Blocks -import net.minecraft.world.level.block.state.BlockState -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.BlockMatchTest -import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest - -object ModOreFeaturesGen : ModOreFeaturesSupport() { - private val endRule = BlockMatchTest(Blocks.END_STONE) - - val RUBY_ORE: ResourceKey> = createKey("ruby_ore") - val SAPPHIRE_ORE: ResourceKey> = createKey("sapphire_ore") - val GRAPHITE_ORE: ResourceKey> = createKey("graphite_ore") - val AQUMARINE_ORE: ResourceKey> = createKey("aqumarine_ore") - val RAINBOW_ORE: ResourceKey> = createKey("rainbow_ore") - val ENDERITE_ORE: ResourceKey> = createKey("enderite_ore") - - override fun bootstrap(context: BootstapContext>) { - val ruby = - listOf( - OreConfiguration.target(ruleTest1, BlockInit.RUBY_ORE.get().defaultBlockState()), - OreConfiguration.target( - ruleTest2, BlockInit.SAPPHIRE_ORE.get().defaultBlockState())) - - val sapphire = - listOf( - OreConfiguration.target( - ruleTest1, BlockInit.SAPPHIRE_ORE.get().defaultBlockState()), - OreConfiguration.target(ruleTest2, BlockInit.RUBY_ORE.get().defaultBlockState())) - - val graphite = - listOf( - OreConfiguration.target( - ruleTest1, BlockInit.GRAPHITE_ORE.get().defaultBlockState()), - OreConfiguration.target( - ruleTest2, BlockInit.AQUMARINE_ORE.get().defaultBlockState())) - - val aqumarine = - listOf( - OreConfiguration.target( - ruleTest1, BlockInit.AQUMARINE_ORE.get().defaultBlockState()), - OreConfiguration.target( - ruleTest2, BlockInit.GRAPHITE_ORE.get().defaultBlockState())) - - val rainbow = - listOf( - OreConfiguration.target(ruleTest1, BlockInit.RAINBOW_ORE.get().defaultBlockState()), - OreConfiguration.target(ruleTest2, BlockInit.RAINBOW_ORE.get().defaultBlockState())) - - val enderite = - listOf( - OreConfiguration.target(endRule, BlockInit.ENDERITE_ORE.get().defaultBlockState())) - - registerOre(context, RUBY_ORE, ruby, 6) - registerOre(context, SAPPHIRE_ORE, sapphire, 3) - registerOre(context, GRAPHITE_ORE, graphite, 6) - registerOre(context, AQUMARINE_ORE, aqumarine, 2) - registerOre(context, RAINBOW_ORE, rainbow, 2) - registerOre(context, ENDERITE_ORE, enderite, 2) - } - - private fun createKey(name: String): ResourceKey> { - return ResourceKey.create(Registries.CONFIGURED_FEATURE, getModIdAndName(name)) - } - - private fun registerOre( - context: BootstapContext>, - ore: ResourceKey>, - targetBlockStates: List, - size: Int, - ) { - context.register( - ore, - ConfiguredFeature>( - Feature.ORE, OreConfiguration(targetBlockStates, size))) - } - - private fun registerOre( - context: BootstapContext>, - ore: ResourceKey>, - ruleTest: RuleTest, - blockState: BlockState, - size: Int, - ) { - context.register( - ore, - ConfiguredFeature>( - Feature.ORE, OreConfiguration(ruleTest, blockState, size))) - } -} diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/world/ModWorldGenerationProvider.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/world/ModWorldGenProvider.kt similarity index 67% rename from src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/world/ModWorldGenerationProvider.kt rename to src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/world/ModWorldGenProvider.kt index f4edc001..e9b4950b 100644 --- a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/world/ModWorldGenerationProvider.kt +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/world/ModWorldGenProvider.kt @@ -19,26 +19,20 @@ package io.github.realyusufismail.armourandtoolsmod.datagen.world import io.github.realyusufismail.armourandtoolsmod.ArmourAndToolsMod.ArmorAndToolsMod.MOD_ID +import io.github.realyusufismail.armourandtoolsmod.worldgen.ModConfiguredFeatures +import io.github.realyusufismail.armourandtoolsmod.worldgen.ModPlacedFeatures import java.util.concurrent.CompletableFuture import net.minecraft.core.HolderLookup import net.minecraft.core.RegistrySetBuilder import net.minecraft.core.registries.Registries import net.minecraft.data.PackOutput -import net.minecraft.data.registries.VanillaRegistries -import net.minecraft.world.level.levelgen.feature.ConfiguredFeature -import net.minecraft.world.level.levelgen.placement.PlacedFeature import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider -/** @see VanillaRegistries */ -class ModWorldGenerationProvider( +class ModWorldGenProvider( output: PackOutput, registries: CompletableFuture, -) : - DatapackBuiltinEntriesProvider( - output, - registries, + val builder: RegistrySetBuilder = RegistrySetBuilder() - .add>( - Registries.CONFIGURED_FEATURE, ModOreFeaturesGen::bootstrap) - .add(Registries.PLACED_FEATURE, ModOrePlacementsGen::bootstrap), - mutableSetOf(MOD_ID)) + .add(Registries.CONFIGURED_FEATURE, ModConfiguredFeatures::bootstrap) + .add(Registries.PLACED_FEATURE, ModPlacedFeatures::bootstrap) +) : DatapackBuiltinEntriesProvider(output, registries, builder, mutableSetOf(MOD_ID)) diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/worldgen/ModConfiguredFeatures.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/worldgen/ModConfiguredFeatures.kt new file mode 100644 index 00000000..0f7aa9ce --- /dev/null +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/worldgen/ModConfiguredFeatures.kt @@ -0,0 +1,116 @@ +/* + * Copyright 2022 RealYusufIsmail. + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.github.realyusufismail.armourandtoolsmod.worldgen + +import io.github.realyusufismail.armourandtoolsmod.ArmourAndToolsMod.ArmorAndToolsMod.MOD_ID +import io.github.realyusufismail.armourandtoolsmod.core.init.BlockInit +import net.minecraft.core.registries.Registries +import net.minecraft.data.worldgen.BootstapContext +import net.minecraft.resources.ResourceKey +import net.minecraft.resources.ResourceLocation +import net.minecraft.tags.BlockTags +import net.minecraft.world.level.block.Blocks +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature +import net.minecraft.world.level.levelgen.feature.Feature +import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration +import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration +import net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTest +import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest +import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest + +object ModConfiguredFeatures { + + val OVERWORLD_RUBY_ORE = registerKey("ruby_ore") + val OVERWORLD_SAPPHIRE_ORE = registerKey("sapphire_ore") + val OVERWORLD_GRAPHITE_ORE = registerKey("graphite_ore") + val OVERWORLD_AQUMARINE_ORE = registerKey("aqumarine_ore") + val OVERWORLD_RAINBOW_ORE = registerKey("rainbow_ore") + val END_ENDERITE_ORE = registerKey("enderite_ore") + + fun bootstrap(context: BootstapContext>) { + val stoneReplaceables: RuleTest = TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES) + val deepslateReplaceables: RuleTest = TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES) + val netherrackReplaceables: RuleTest = BlockMatchTest(Blocks.NETHERRACK) + val endstoneReplaceables: RuleTest = BlockMatchTest(Blocks.END_STONE) + + val ruby = + listOf( + OreConfiguration.target( + stoneReplaceables, BlockInit.RUBY_ORE.get().defaultBlockState()), + OreConfiguration.target( + deepslateReplaceables, BlockInit.DEEPSLATE_RUBY_ORE.get().defaultBlockState())) + + val sapphire = + listOf( + OreConfiguration.target( + stoneReplaceables, BlockInit.SAPPHIRE_ORE.get().defaultBlockState()), + OreConfiguration.target( + deepslateReplaceables, + BlockInit.DEEPSLATE_SAPPHIRE_ORE.get().defaultBlockState())) + + val graphite = + listOf( + OreConfiguration.target( + stoneReplaceables, BlockInit.GRAPHITE_ORE.get().defaultBlockState()), + OreConfiguration.target( + deepslateReplaceables, + BlockInit.DEEPSLATE_GRAPHITE_ORE.get().defaultBlockState())) + + val aqumarine = + listOf( + OreConfiguration.target( + stoneReplaceables, BlockInit.AQUMARINE_ORE.get().defaultBlockState()), + OreConfiguration.target( + deepslateReplaceables, + BlockInit.DEEPSLATE_AQUMARINE_ORE.get().defaultBlockState())) + + val rainbow = + listOf( + OreConfiguration.target( + stoneReplaceables, BlockInit.RAINBOW_ORE.get().defaultBlockState()), + OreConfiguration.target( + deepslateReplaceables, + BlockInit.DEEPSLATE_RAINBOW_ORE.get().defaultBlockState())) + + val enderite = + listOf( + OreConfiguration.target( + endstoneReplaceables, BlockInit.ENDERITE_ORE.get().defaultBlockState())) + + register(context, OVERWORLD_RUBY_ORE, Feature.ORE, OreConfiguration(ruby, 4)) + register(context, OVERWORLD_SAPPHIRE_ORE, Feature.ORE, OreConfiguration(sapphire, 3)) + register(context, OVERWORLD_GRAPHITE_ORE, Feature.ORE, OreConfiguration(graphite, 4)) + register(context, OVERWORLD_AQUMARINE_ORE, Feature.ORE, OreConfiguration(aqumarine, 4)) + register(context, OVERWORLD_RAINBOW_ORE, Feature.ORE, OreConfiguration(rainbow, 3)) + register(context, END_ENDERITE_ORE, Feature.ORE, OreConfiguration(enderite, 4)) + } + + private fun registerKey(name: String): ResourceKey> { + return ResourceKey.create(Registries.CONFIGURED_FEATURE, ResourceLocation(MOD_ID, name)) + } + + private fun > register( + context: BootstapContext>, + key: ResourceKey>, + feature: F, + configuration: FC + ) { + context.register(key, ConfiguredFeature(feature, configuration)) + } +} diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/worldgen/ModOrePlacement.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/worldgen/ModOrePlacement.kt new file mode 100644 index 00000000..70d03f42 --- /dev/null +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/worldgen/ModOrePlacement.kt @@ -0,0 +1,45 @@ +/* + * Copyright 2022 RealYusufIsmail. + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.github.realyusufismail.armourandtoolsmod.worldgen + +import net.minecraft.world.level.levelgen.placement.* + +object ModOrePlacement { + fun orePlacement( + placementModifier: PlacementModifier, + placementModifier1: PlacementModifier + ): List { + return listOf( + placementModifier, InSquarePlacement.spread(), placementModifier1, BiomeFilter.biome()) + } + + fun commonOrePlacement( + count: Int, + placementModifier: PlacementModifier + ): List { + return orePlacement(CountPlacement.of(count), placementModifier) + } + + fun rareOrePlacement( + count: Int, + placementModifier: PlacementModifier + ): List { + return orePlacement(RarityFilter.onAverageOnceEvery(count), placementModifier) + } +} diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/world/ModOrePlacementsGen.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/worldgen/ModPlacedFeatures.kt similarity index 64% rename from src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/world/ModOrePlacementsGen.kt rename to src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/worldgen/ModPlacedFeatures.kt index b732143d..8dbfe823 100644 --- a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/world/ModOrePlacementsGen.kt +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/worldgen/ModPlacedFeatures.kt @@ -16,22 +16,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.github.realyusufismail.armourandtoolsmod.datagen.world +package io.github.realyusufismail.armourandtoolsmod.worldgen -import io.github.realyusufismail.armourandtoolsmod.ArmourAndToolsMod.ArmorAndToolsMod.getModIdAndName -import io.github.realyusufismail.realyusufismailcore.data.support.oregen.ModOrePlacementsSupport +import io.github.realyusufismail.armourandtoolsmod.ArmourAndToolsMod.ArmorAndToolsMod.MOD_ID import net.minecraft.core.Holder -import net.minecraft.core.HolderGetter import net.minecraft.core.registries.Registries import net.minecraft.data.worldgen.BootstapContext import net.minecraft.resources.ResourceKey +import net.minecraft.resources.ResourceLocation import net.minecraft.world.level.levelgen.VerticalAnchor import net.minecraft.world.level.levelgen.feature.ConfiguredFeature import net.minecraft.world.level.levelgen.placement.HeightRangePlacement import net.minecraft.world.level.levelgen.placement.PlacedFeature import net.minecraft.world.level.levelgen.placement.PlacementModifier -object ModOrePlacementsGen : ModOrePlacementsSupport() { +object ModPlacedFeatures { val RUBY_ORE: ResourceKey = createKey("ruby_ore") val SAPPHIRE_ORE: ResourceKey = createKey("sapphire_ore") @@ -40,29 +39,28 @@ object ModOrePlacementsGen : ModOrePlacementsSupport() { val RAINBOW_ORE: ResourceKey = createKey("rainbow_ore") val ENDERITE_ORE: ResourceKey = createKey("enderite_ore") - override fun bootstrap(context: BootstapContext) { - val holdergetter: HolderGetter> = - context.lookup(Registries.CONFIGURED_FEATURE) + fun bootstrap(context: BootstapContext) { + val configuredFeatures = context.lookup(Registries.CONFIGURED_FEATURE) val holder: Holder> = - holdergetter.getOrThrow(ModOreFeaturesGen.RUBY_ORE) + configuredFeatures.getOrThrow(ModConfiguredFeatures.OVERWORLD_RUBY_ORE) val holder2: Holder> = - holdergetter.getOrThrow(ModOreFeaturesGen.SAPPHIRE_ORE) + configuredFeatures.getOrThrow(ModConfiguredFeatures.OVERWORLD_SAPPHIRE_ORE) val holder3: Holder> = - holdergetter.getOrThrow(ModOreFeaturesGen.GRAPHITE_ORE) + configuredFeatures.getOrThrow(ModConfiguredFeatures.OVERWORLD_GRAPHITE_ORE) val holder4: Holder> = - holdergetter.getOrThrow(ModOreFeaturesGen.AQUMARINE_ORE) + configuredFeatures.getOrThrow(ModConfiguredFeatures.OVERWORLD_AQUMARINE_ORE) val holder5: Holder> = - holdergetter.getOrThrow(ModOreFeaturesGen.RAINBOW_ORE) + configuredFeatures.getOrThrow(ModConfiguredFeatures.OVERWORLD_RAINBOW_ORE) val holder6: Holder> = - holdergetter.getOrThrow(ModOreFeaturesGen.ENDERITE_ORE) + configuredFeatures.getOrThrow(ModConfiguredFeatures.END_ENDERITE_ORE) register( context, RUBY_ORE, holder, - commonOrePlacement( - 3, + ModOrePlacement.commonOrePlacement( + 3, // veins per chunk HeightRangePlacement.uniform( VerticalAnchor.absolute(-64), VerticalAnchor.absolute(20)))) @@ -70,58 +68,68 @@ object ModOrePlacementsGen : ModOrePlacementsSupport() { context, SAPPHIRE_ORE, holder2, - commonOrePlacement( + ModOrePlacement.commonOrePlacement( 4, HeightRangePlacement.uniform( - VerticalAnchor.absolute(-64), VerticalAnchor.absolute(10)))) + VerticalAnchor.absolute(-64), VerticalAnchor.absolute(20)))) register( context, GRAPHITE_ORE, holder3, - commonOrePlacement( + ModOrePlacement.commonOrePlacement( 4, HeightRangePlacement.uniform( - VerticalAnchor.absolute(-64), VerticalAnchor.absolute(10)))) + VerticalAnchor.absolute(-64), VerticalAnchor.absolute(30)))) register( context, AQUMARINE_ORE, holder4, - commonOrePlacement( + ModOrePlacement.commonOrePlacement( 4, HeightRangePlacement.uniform( - VerticalAnchor.absolute(-64), VerticalAnchor.absolute(-20)))) + VerticalAnchor.absolute(-64), VerticalAnchor.absolute(40)))) register( context, RAINBOW_ORE, holder5, - commonOrePlacement( + ModOrePlacement.commonOrePlacement( 3, HeightRangePlacement.uniform( - VerticalAnchor.absolute(-64), VerticalAnchor.absolute(-20)))) + VerticalAnchor.absolute(-64), VerticalAnchor.absolute(40)))) register( context, ENDERITE_ORE, holder6, - commonOrePlacement( + ModOrePlacement.commonOrePlacement( 4, HeightRangePlacement.uniform( - VerticalAnchor.absolute(2), VerticalAnchor.absolute(32)))) + VerticalAnchor.absolute(-64), VerticalAnchor.absolute(40)))) } private fun createKey(name: String): ResourceKey { - return ResourceKey.create(Registries.PLACED_FEATURE, getModIdAndName(name)) + return ResourceKey.create( + Registries.PLACED_FEATURE, ResourceLocation(MOD_ID, name)) + } + + private fun register( + context: BootstapContext, + key: ResourceKey, + configuration: Holder>, + modifiers: List + ) { + context.register(key, PlacedFeature(configuration, java.util.List.copyOf(modifiers))) } private fun register( context: BootstapContext, key: ResourceKey, - holder: Holder>, - placement: List, + configuration: Holder>, + vararg modifiers: PlacementModifier ) { - context.register(key, PlacedFeature(holder, placement)) + register(context, key, configuration, listOf(*modifiers)) } }