Skip to content

Commit

Permalink
fixed issue with ore gen
Browse files Browse the repository at this point in the history
  • Loading branch information
RealYusufIsmail committed Nov 25, 2023
1 parent 63765e6 commit 997c532
Show file tree
Hide file tree
Showing 16 changed files with 169 additions and 8 deletions.
4 changes: 4 additions & 0 deletions neoforge/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

# [1.20.2-2.0.0.beta9] - 2023-11-24

### Ore gen has now been tested and fixed. All ores should now generate properly.

# [1.20.2-2.0.0.beta8] - 2023-11-24

### Minor bug fixes.
Expand Down
2 changes: 1 addition & 1 deletion neoforge/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kotlin.code.style=official
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

modVersion = 1.20.2-2.0.0.beta8
modVersion = 1.20.2-2.0.0.beta9
mcVersion = 1.20.2
projectId = 480779
modId = temporalsmith
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
// 1.20.2 2023-11-16T22:20:28.533679 Registries
// 1.20.2 2023-11-25T22:58:36.998559 Registries
8811f7ebb0231c679e9da0ded45180c8d5784e4f data/temporalsmith/neoforge/biome_modifier/add_aqumarine_ore.json
970aeb29b13aa54f84e12f7b883e51d26d76c942 data/temporalsmith/neoforge/biome_modifier/add_enderite_ore.json
e01058f2c8e6e8613f1091c97da5a3ca2d5e02ec data/temporalsmith/neoforge/biome_modifier/add_graphite_ore.json
218a15536ac4219b6def8a8c5f03abacdff73ece data/temporalsmith/neoforge/biome_modifier/add_imperium_ore.json
dba70b28432105f6e973f655c23212620d93fd32 data/temporalsmith/neoforge/biome_modifier/add_rainbow_ore.json
0416c6da5c3d71c0d613f3b76db4513442ffe94d data/temporalsmith/neoforge/biome_modifier/add_ruby_ore.json
5475fc5a7c3c864d7388d28b1e12ca7ac58e248d data/temporalsmith/neoforge/biome_modifier/add_sapphire_ore.json
52e07796b3598ae2784352122ffaaf4500ac1385 data/temporalsmith/worldgen/configured_feature/aqumarine_ore.json
06d2f6fc59b416a218d7f1908e39c8e8cd38f0cd data/temporalsmith/worldgen/configured_feature/enderite_ore.json
200476c7e225de0670ae88f408d09f3539f4a637 data/temporalsmith/worldgen/configured_feature/graphite_ore.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "neoforge:add_features",
"biomes": "#minecraft:is_overworld",
"features": "temporalsmith:aqumarine_ore",
"step": "underground_ores"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "neoforge:add_features",
"biomes": "#minecraft:is_end",
"features": "temporalsmith:enderite_ore",
"step": "underground_ores"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "neoforge:add_features",
"biomes": "#minecraft:is_overworld",
"features": "temporalsmith:graphite_ore",
"step": "underground_ores"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "neoforge:add_features",
"biomes": "#minecraft:is_overworld",
"features": "temporalsmith:imperium_ore",
"step": "underground_ores"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "neoforge:add_features",
"biomes": "#minecraft:is_overworld",
"features": "temporalsmith:rainbow_ore",
"step": "underground_ores"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "neoforge:add_features",
"biomes": "#minecraft:is_overworld",
"features": "temporalsmith:ruby_ore",
"step": "underground_ores"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "neoforge:add_features",
"biomes": "#minecraft:is_overworld",
"features": "temporalsmith:sapphire_ore",
"step": "underground_ores"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package io.github.realyusufismail.temporalsmith.datagen.world

import io.github.realyusufismail.temporalsmith.TemporalSmith.TemporalSmith.MOD_ID
import io.github.realyusufismail.temporalsmith.worldgen.ModBiomeModifiers
import io.github.realyusufismail.temporalsmith.worldgen.ModConfiguredFeatures
import io.github.realyusufismail.temporalsmith.worldgen.ModPlacedFeatures
import java.util.concurrent.CompletableFuture
Expand All @@ -27,6 +28,7 @@ import net.minecraft.core.RegistrySetBuilder
import net.minecraft.core.registries.Registries
import net.minecraft.data.PackOutput
import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider
import net.neoforged.neoforge.registries.NeoForgeRegistries

class ModWorldGenProvider(
output: PackOutput,
Expand All @@ -35,4 +37,5 @@ class ModWorldGenProvider(
RegistrySetBuilder()
.add(Registries.CONFIGURED_FEATURE, ModConfiguredFeatures::bootstrap)
.add(Registries.PLACED_FEATURE, ModPlacedFeatures::bootstrap)
.add(NeoForgeRegistries.Keys.BIOME_MODIFIERS, ModBiomeModifiers::bootStrap)
) : DatapackBuiltinEntriesProvider(output, registries, builder, mutableSetOf(MOD_ID))
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* Copyright 2023 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.temporalsmith.worldgen

import io.github.realyusufismail.temporalsmith.TemporalSmith.TemporalSmith.MOD_ID
import net.minecraft.core.HolderSet
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.BiomeTags
import net.minecraft.world.level.levelgen.GenerationStep
import net.neoforged.neoforge.common.world.BiomeModifier
import net.neoforged.neoforge.common.world.BiomeModifiers
import net.neoforged.neoforge.registries.NeoForgeRegistries

object ModBiomeModifiers {
val ADD_RUBY_ORE: ResourceKey<BiomeModifier> = registerKey("add_ruby_ore")
val ADD_SAPPHIRE_ORE: ResourceKey<BiomeModifier> = registerKey("add_sapphire_ore")
val ADD_GRAPHITE_ORE: ResourceKey<BiomeModifier> = registerKey("add_graphite_ore")
val ADD_AQUMARINE_ORE: ResourceKey<BiomeModifier> = registerKey("add_aqumarine_ore")
val ADD_RAINBOW_ORE: ResourceKey<BiomeModifier> = registerKey("add_rainbow_ore")
val ADD_IMPERIUM_ORE: ResourceKey<BiomeModifier> = registerKey("add_imperium_ore")
val ADD_ENDERITE_ORE: ResourceKey<BiomeModifier> = registerKey("add_enderite_ore")

fun bootStrap(context: BootstapContext<BiomeModifier>) {
val placedFeatures = context.lookup(Registries.PLACED_FEATURE)
val biomes = context.lookup(Registries.BIOME)

context.register(
ADD_RUBY_ORE,
BiomeModifiers.AddFeaturesBiomeModifier(
biomes.getOrThrow(BiomeTags.IS_OVERWORLD),
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.RUBY_ORE)),
GenerationStep.Decoration.UNDERGROUND_ORES))

context.register(
ADD_SAPPHIRE_ORE,
BiomeModifiers.AddFeaturesBiomeModifier(
biomes.getOrThrow(BiomeTags.IS_OVERWORLD),
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.SAPPHIRE_ORE)),
GenerationStep.Decoration.UNDERGROUND_ORES))

context.register(
ADD_GRAPHITE_ORE,
BiomeModifiers.AddFeaturesBiomeModifier(
biomes.getOrThrow(BiomeTags.IS_OVERWORLD),
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.GRAPHITE_ORE)),
GenerationStep.Decoration.UNDERGROUND_ORES))

context.register(
ADD_AQUMARINE_ORE,
BiomeModifiers.AddFeaturesBiomeModifier(
biomes.getOrThrow(BiomeTags.IS_OVERWORLD),
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.AQUMARINE_ORE)),
GenerationStep.Decoration.UNDERGROUND_ORES))

context.register(
ADD_RAINBOW_ORE,
BiomeModifiers.AddFeaturesBiomeModifier(
biomes.getOrThrow(BiomeTags.IS_OVERWORLD),
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.RAINBOW_ORE)),
GenerationStep.Decoration.UNDERGROUND_ORES))

context.register(
ADD_IMPERIUM_ORE,
BiomeModifiers.AddFeaturesBiomeModifier(
biomes.getOrThrow(BiomeTags.IS_OVERWORLD),
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.IMPERIUM_ORE)),
GenerationStep.Decoration.UNDERGROUND_ORES))

context.register(
ADD_ENDERITE_ORE,
BiomeModifiers.AddFeaturesBiomeModifier(
biomes.getOrThrow(BiomeTags.IS_END),
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.ENDERITE_ORE)),
GenerationStep.Decoration.UNDERGROUND_ORES))
}

private fun registerKey(name: String): ResourceKey<BiomeModifier> {
return ResourceKey.create(
NeoForgeRegistries.Keys.BIOME_MODIFIERS, ResourceLocation(MOD_ID, name))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTes
import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest
import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest

/** @see net.minecraft.data.worldgen.features.OreFeatures */
object ModConfiguredFeatures {

// overworld
Expand Down Expand Up @@ -102,6 +103,7 @@ object ModConfiguredFeatures {
OreConfiguration.target(
netherrackReplaceables, BlockInit.IMPERIUM_ORE.get().defaultBlockState()))

// the number is the vein size
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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package io.github.realyusufismail.temporalsmith.worldgen
import net.minecraft.world.level.levelgen.placement.*

object ModOrePlacement {
fun orePlacement(
private fun orePlacement(
placementModifier: PlacementModifier,
placementModifier1: PlacementModifier
): List<PlacementModifier> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import net.minecraft.world.level.levelgen.placement.HeightRangePlacement
import net.minecraft.world.level.levelgen.placement.PlacedFeature
import net.minecraft.world.level.levelgen.placement.PlacementModifier

/** @see net.minecraft.data.worldgen.placement.OrePlacements */
object ModPlacedFeatures {

val RUBY_ORE: ResourceKey<PlacedFeature> = createKey("ruby_ore")
Expand Down Expand Up @@ -65,7 +66,9 @@ object ModPlacedFeatures {
ModOrePlacement.commonOrePlacement(
3, // veins per chunk
HeightRangePlacement.uniform(
VerticalAnchor.absolute(-64), VerticalAnchor.absolute(20))))
// veins from y level -64 to 20
VerticalAnchor.absolute(-64),
VerticalAnchor.absolute(20))))

register(
context,
Expand Down Expand Up @@ -110,7 +113,7 @@ object ModPlacedFeatures {
ModOrePlacement.commonOrePlacement(
4,
HeightRangePlacement.uniform(
VerticalAnchor.absolute(-64), VerticalAnchor.absolute(40))))
VerticalAnchor.absolute(-64), VerticalAnchor.absolute(80))))

register(
context,
Expand All @@ -119,7 +122,7 @@ object ModPlacedFeatures {
ModOrePlacement.commonOrePlacement(
4,
HeightRangePlacement.uniform(
VerticalAnchor.absolute(-64), VerticalAnchor.absolute(50))))
VerticalAnchor.absolute(-64), VerticalAnchor.absolute(40))))
}

private fun createKey(name: String): ResourceKey<PlacedFeature> {
Expand Down
4 changes: 2 additions & 2 deletions neoforge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ license = "Apache 2.0" #mandatory
issueTrackerURL = "https://github.com/RealYusufIsmail-Mc-Mods/TemporalSmith/issues"
[[mods]]
modId = "temporalsmith"
version = "1.20.2-1.0.0.beta8"
version = "1.20.2-1.0.0.beta9"
displayName = "TemporalSmith: Aetheric Arsenal Expansion"
logoFile = "logo.png"
updateJSONURL = "https://forge.curseupdate.com/480779/temporalsmith"
Expand All @@ -30,6 +30,6 @@ side = "BOTH"
[[dependencies.temporalsmith]]
modId = "realyusufismailcore"
mandatory = true
versionRange = "[1.20.2-1.0.3,)"
versionRange = "[1.20.2-1.1.2,)"
ordering = "NONE"
side = "BOTH"

0 comments on commit 997c532

Please sign in to comment.