Ellipsoid heart with worms tritanium placement
This commit is contained in:
parent
00ff8fa91e
commit
611f4055e9
@ -33,8 +33,10 @@ import ru.dbotthepony.mc.otm.registry.game.MBlocks
|
|||||||
import ru.dbotthepony.mc.otm.registry.data.MWorldGenFeatures
|
import ru.dbotthepony.mc.otm.registry.data.MWorldGenFeatures
|
||||||
import ru.dbotthepony.mc.otm.worldgen.feature.BlackHolePlacerFeature
|
import ru.dbotthepony.mc.otm.worldgen.feature.BlackHolePlacerFeature
|
||||||
import ru.dbotthepony.mc.otm.worldgen.feature.DebugPlacerFeature
|
import ru.dbotthepony.mc.otm.worldgen.feature.DebugPlacerFeature
|
||||||
|
import ru.dbotthepony.mc.otm.worldgen.placement.ChainPlacement
|
||||||
import ru.dbotthepony.mc.otm.worldgen.placement.EnormousPlacement
|
import ru.dbotthepony.mc.otm.worldgen.placement.EnormousPlacement
|
||||||
import ru.dbotthepony.mc.otm.worldgen.placement.EllipsoidPlacement
|
import ru.dbotthepony.mc.otm.worldgen.placement.EllipsoidPlacement
|
||||||
|
import ru.dbotthepony.mc.otm.worldgen.placement.SplitPlacement
|
||||||
import ru.dbotthepony.mc.otm.worldgen.placement.WormPlacement
|
import ru.dbotthepony.mc.otm.worldgen.placement.WormPlacement
|
||||||
|
|
||||||
private object ConfiguredFeatures {
|
private object ConfiguredFeatures {
|
||||||
@ -59,8 +61,8 @@ fun registerConfiguredFeatures(context: BootstrapContext<ConfiguredFeature<*, *>
|
|||||||
)
|
)
|
||||||
|
|
||||||
context.register(ConfiguredFeatures.TRITANIUM_ORE, ConfiguredFeature(Feature.ORE, OreConfiguration(target, 9)))
|
context.register(ConfiguredFeatures.TRITANIUM_ORE, ConfiguredFeature(Feature.ORE, OreConfiguration(target, 9)))
|
||||||
//context.register(ConfiguredFeatures.TRITANIUM_ORE_SMALL, ConfiguredFeature(Feature.REPLACE_SINGLE_BLOCK, ReplaceBlockConfiguration(target)))
|
context.register(ConfiguredFeatures.TRITANIUM_ORE_SMALL, ConfiguredFeature(Feature.REPLACE_SINGLE_BLOCK, ReplaceBlockConfiguration(target)))
|
||||||
context.register(ConfiguredFeatures.TRITANIUM_ORE_SMALL, ConfiguredFeature(MWorldGenFeatures.DEBUG_PLACEMENT, DebugPlacerFeature.Config(MBlocks.TRITANIUM_ORE.defaultBlockState())))
|
//context.register(ConfiguredFeatures.TRITANIUM_ORE_SMALL, ConfiguredFeature(MWorldGenFeatures.DEBUG_PLACEMENT, DebugPlacerFeature.Config(MBlocks.TRITANIUM_ORE.defaultBlockState())))
|
||||||
}
|
}
|
||||||
|
|
||||||
run {
|
run {
|
||||||
@ -120,28 +122,45 @@ fun registerPlacedFeatures(context: BootstrapContext<PlacedFeature>) {
|
|||||||
chunkScanRange = 24,
|
chunkScanRange = 24,
|
||||||
seedMix = 9284343575495L,
|
seedMix = 9284343575495L,
|
||||||
children = listOf(
|
children = listOf(
|
||||||
RarityFilter.onAverageOnceEvery(300),
|
RarityFilter.onAverageOnceEvery(140),
|
||||||
InSquarePlacement.spread(),
|
InSquarePlacement.spread(),
|
||||||
HeightRangePlacement.of(StandardDeviationHeightProvider(VerticalAnchor.absolute(120), 15.0)),
|
HeightRangePlacement.of(StandardDeviationHeightProvider(VerticalAnchor.absolute(-40), 15.0)),
|
||||||
WormPlacement(
|
SplitPlacement(
|
||||||
length = UniformInt.of(120, 400),
|
// "heart"
|
||||||
turnRateXY = WormPlacement.normalDistributedTurnRate(10f),
|
EllipsoidPlacement(
|
||||||
turnRateXZ = WormPlacement.normalDistributedTurnRate(60f),
|
count = UniformInt.of(600, 900),
|
||||||
turnSpeedXZ = WormPlacement.constantTurnRate(10f),
|
xLength = UniformFloat.of(9f, 12f),
|
||||||
turnSpeedXY = WormPlacement.constantTurnRate(4f),
|
yLength = UniformFloat.of(9f, 12f),
|
||||||
turnChanceXY = BooleanProvider.Unbiased(6),
|
zLength = UniformFloat.of(9f, 12f),
|
||||||
turnChanceXZ = BooleanProvider.BiasedLinear(0.6f, 5),
|
x = ClampedNormalFloat.of(0f, 0.4f, -1f, 1f),
|
||||||
maxTravelUp = 16,
|
y = ClampedNormalFloat.of(0f, 0.4f, -1f, 1f),
|
||||||
maxTravelDown = 16,
|
z = ClampedNormalFloat.of(0f, 0.4f, -1f, 1f),
|
||||||
),
|
),
|
||||||
EllipsoidPlacement(
|
// "branches"
|
||||||
count = UniformInt.of(4, 7),
|
ChainPlacement(
|
||||||
xLength = ConstantFloat.of(6f),
|
CountPlacement.of(UniformInt.of(2, 7)),
|
||||||
yLength = ConstantFloat.of(6f),
|
WormPlacement(
|
||||||
zLength = ConstantFloat.of(6f),
|
length = UniformInt.of(60, 120),
|
||||||
x = ClampedNormalFloat.of(0f, 0.2f, -1f, 1f),
|
turnRateXY = WormPlacement.normalDistributedTurnRate(2f, 3f),
|
||||||
y = ClampedNormalFloat.of(0f, 0.2f, -1f, 1f),
|
initialAngleXY = WormPlacement.normalDistributedTurnRate(3f, 4f),
|
||||||
z = ClampedNormalFloat.of(0f, 0.2f, -1f, 1f),
|
turnRateXZ = WormPlacement.normalDistributedTurnRate(30f),
|
||||||
|
turnSpeedXZ = WormPlacement.constantTurnRate(10f),
|
||||||
|
turnSpeedXY = WormPlacement.constantTurnRate(4f),
|
||||||
|
turnChanceXY = BooleanProvider.Unbiased(6),
|
||||||
|
turnChanceXZ = BooleanProvider.BiasedLinear(0.6f, 5),
|
||||||
|
maxTravelUp = 90,
|
||||||
|
maxTravelDown = 10,
|
||||||
|
),
|
||||||
|
EllipsoidPlacement(
|
||||||
|
count = UniformInt.of(3, 6),
|
||||||
|
xLength = ConstantFloat.of(4f),
|
||||||
|
yLength = ConstantFloat.of(4f),
|
||||||
|
zLength = ConstantFloat.of(4f),
|
||||||
|
x = ClampedNormalFloat.of(0f, 0.2f, -1f, 1f),
|
||||||
|
y = ClampedNormalFloat.of(0f, 0.2f, -1f, 1f),
|
||||||
|
z = ClampedNormalFloat.of(0f, 0.2f, -1f, 1f),
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -4,8 +4,10 @@ import net.minecraft.core.registries.BuiltInRegistries
|
|||||||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType
|
import net.minecraft.world.level.levelgen.placement.PlacementModifierType
|
||||||
import net.neoforged.bus.api.IEventBus
|
import net.neoforged.bus.api.IEventBus
|
||||||
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
|
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
|
||||||
|
import ru.dbotthepony.mc.otm.worldgen.placement.ChainPlacement
|
||||||
import ru.dbotthepony.mc.otm.worldgen.placement.EllipsoidPlacement
|
import ru.dbotthepony.mc.otm.worldgen.placement.EllipsoidPlacement
|
||||||
import ru.dbotthepony.mc.otm.worldgen.placement.EnormousPlacement
|
import ru.dbotthepony.mc.otm.worldgen.placement.EnormousPlacement
|
||||||
|
import ru.dbotthepony.mc.otm.worldgen.placement.SplitPlacement
|
||||||
import ru.dbotthepony.mc.otm.worldgen.placement.WormPlacement
|
import ru.dbotthepony.mc.otm.worldgen.placement.WormPlacement
|
||||||
|
|
||||||
object MPlacementModifiers {
|
object MPlacementModifiers {
|
||||||
@ -18,4 +20,6 @@ object MPlacementModifiers {
|
|||||||
val ENORMOUS by registry.register("enormous") { PlacementModifierType { EnormousPlacement.CODEC } }
|
val ENORMOUS by registry.register("enormous") { PlacementModifierType { EnormousPlacement.CODEC } }
|
||||||
val ELLIPSOID_PLACEMENT by registry.register("ellipsoid") { PlacementModifierType { EllipsoidPlacement.CODEC } }
|
val ELLIPSOID_PLACEMENT by registry.register("ellipsoid") { PlacementModifierType { EllipsoidPlacement.CODEC } }
|
||||||
val WORM_PLACEMENT by registry.register("worm") { PlacementModifierType { WormPlacement.CODEC } }
|
val WORM_PLACEMENT by registry.register("worm") { PlacementModifierType { WormPlacement.CODEC } }
|
||||||
|
val SPLIT by registry.register("split") { PlacementModifierType { SplitPlacement.CODEC} }
|
||||||
|
val CHAIN by registry.register("chain") { PlacementModifierType { ChainPlacement.CODEC} }
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.worldgen.placement
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList
|
||||||
|
import com.mojang.serialization.Codec
|
||||||
|
import com.mojang.serialization.MapCodec
|
||||||
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.util.RandomSource
|
||||||
|
import net.minecraft.world.level.levelgen.placement.PlacementContext
|
||||||
|
import net.minecraft.world.level.levelgen.placement.PlacementModifier
|
||||||
|
import net.minecraft.world.level.levelgen.placement.PlacementModifierType
|
||||||
|
import ru.dbotthepony.mc.otm.registry.data.MPlacementModifiers
|
||||||
|
import java.util.stream.Stream
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Daisy-chaining placements. Required only when using placement modifiers which operate on children list
|
||||||
|
*/
|
||||||
|
class ChainPlacement(
|
||||||
|
val children: List<PlacementModifier>
|
||||||
|
) : PlacementModifier() {
|
||||||
|
constructor(vararg children: PlacementModifier) : this(ImmutableList.copyOf(children))
|
||||||
|
|
||||||
|
override fun getPositions(context: PlacementContext, random: RandomSource, pos: BlockPos): Stream<BlockPos> {
|
||||||
|
var stream = Stream.of(pos)
|
||||||
|
children.forEach { c -> stream = stream.flatMap { c.getPositions(context, random, it) } }
|
||||||
|
return stream
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun type(): PlacementModifierType<*> {
|
||||||
|
return MPlacementModifiers.CHAIN
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
val CODEC: MapCodec<ChainPlacement> = Codec.list(PlacementModifier.CODEC).xmap(::ChainPlacement, ChainPlacement::children).fieldOf("children")
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package ru.dbotthepony.mc.otm.worldgen.placement
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList
|
||||||
|
import com.mojang.serialization.Codec
|
||||||
|
import com.mojang.serialization.MapCodec
|
||||||
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.util.RandomSource
|
||||||
|
import net.minecraft.world.level.levelgen.placement.PlacementContext
|
||||||
|
import net.minecraft.world.level.levelgen.placement.PlacementModifier
|
||||||
|
import net.minecraft.world.level.levelgen.placement.PlacementModifierType
|
||||||
|
import ru.dbotthepony.mc.otm.registry.data.MPlacementModifiers
|
||||||
|
import java.util.stream.Stream
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Or "shard" placement, if you will.
|
||||||
|
*
|
||||||
|
* Basically, allows multiple [PlacementModifier]s to split/branch off from provided point.
|
||||||
|
*/
|
||||||
|
class SplitPlacement(
|
||||||
|
val children: List<PlacementModifier>
|
||||||
|
) : PlacementModifier() {
|
||||||
|
constructor(vararg children: PlacementModifier) : this(ImmutableList.copyOf(children))
|
||||||
|
|
||||||
|
override fun getPositions(context: PlacementContext, random: RandomSource, pos: BlockPos): Stream<BlockPos> {
|
||||||
|
return children.stream().flatMap { it.getPositions(context, random, pos) }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun type(): PlacementModifierType<*> {
|
||||||
|
return MPlacementModifiers.SPLIT
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
val CODEC: MapCodec<SplitPlacement> = Codec.list(PlacementModifier.CODEC).xmap(::SplitPlacement, SplitPlacement::children).fieldOf("children")
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user