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.worldgen.feature.BlackHolePlacerFeature
|
||||
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.EllipsoidPlacement
|
||||
import ru.dbotthepony.mc.otm.worldgen.placement.SplitPlacement
|
||||
import ru.dbotthepony.mc.otm.worldgen.placement.WormPlacement
|
||||
|
||||
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_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(Feature.REPLACE_SINGLE_BLOCK, ReplaceBlockConfiguration(target)))
|
||||
//context.register(ConfiguredFeatures.TRITANIUM_ORE_SMALL, ConfiguredFeature(MWorldGenFeatures.DEBUG_PLACEMENT, DebugPlacerFeature.Config(MBlocks.TRITANIUM_ORE.defaultBlockState())))
|
||||
}
|
||||
|
||||
run {
|
||||
@ -120,25 +122,40 @@ fun registerPlacedFeatures(context: BootstrapContext<PlacedFeature>) {
|
||||
chunkScanRange = 24,
|
||||
seedMix = 9284343575495L,
|
||||
children = listOf(
|
||||
RarityFilter.onAverageOnceEvery(300),
|
||||
RarityFilter.onAverageOnceEvery(140),
|
||||
InSquarePlacement.spread(),
|
||||
HeightRangePlacement.of(StandardDeviationHeightProvider(VerticalAnchor.absolute(120), 15.0)),
|
||||
HeightRangePlacement.of(StandardDeviationHeightProvider(VerticalAnchor.absolute(-40), 15.0)),
|
||||
SplitPlacement(
|
||||
// "heart"
|
||||
EllipsoidPlacement(
|
||||
count = UniformInt.of(600, 900),
|
||||
xLength = UniformFloat.of(9f, 12f),
|
||||
yLength = UniformFloat.of(9f, 12f),
|
||||
zLength = UniformFloat.of(9f, 12f),
|
||||
x = ClampedNormalFloat.of(0f, 0.4f, -1f, 1f),
|
||||
y = ClampedNormalFloat.of(0f, 0.4f, -1f, 1f),
|
||||
z = ClampedNormalFloat.of(0f, 0.4f, -1f, 1f),
|
||||
),
|
||||
// "branches"
|
||||
ChainPlacement(
|
||||
CountPlacement.of(UniformInt.of(2, 7)),
|
||||
WormPlacement(
|
||||
length = UniformInt.of(120, 400),
|
||||
turnRateXY = WormPlacement.normalDistributedTurnRate(10f),
|
||||
turnRateXZ = WormPlacement.normalDistributedTurnRate(60f),
|
||||
length = UniformInt.of(60, 120),
|
||||
turnRateXY = WormPlacement.normalDistributedTurnRate(2f, 3f),
|
||||
initialAngleXY = WormPlacement.normalDistributedTurnRate(3f, 4f),
|
||||
turnRateXZ = WormPlacement.normalDistributedTurnRate(30f),
|
||||
turnSpeedXZ = WormPlacement.constantTurnRate(10f),
|
||||
turnSpeedXY = WormPlacement.constantTurnRate(4f),
|
||||
turnChanceXY = BooleanProvider.Unbiased(6),
|
||||
turnChanceXZ = BooleanProvider.BiasedLinear(0.6f, 5),
|
||||
maxTravelUp = 16,
|
||||
maxTravelDown = 16,
|
||||
maxTravelUp = 90,
|
||||
maxTravelDown = 10,
|
||||
),
|
||||
EllipsoidPlacement(
|
||||
count = UniformInt.of(4, 7),
|
||||
xLength = ConstantFloat.of(6f),
|
||||
yLength = ConstantFloat.of(6f),
|
||||
zLength = ConstantFloat.of(6f),
|
||||
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),
|
||||
@ -146,6 +163,8 @@ fun registerPlacedFeatures(context: BootstrapContext<PlacedFeature>) {
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,10 @@ import net.minecraft.core.registries.BuiltInRegistries
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType
|
||||
import net.neoforged.bus.api.IEventBus
|
||||
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.EnormousPlacement
|
||||
import ru.dbotthepony.mc.otm.worldgen.placement.SplitPlacement
|
||||
import ru.dbotthepony.mc.otm.worldgen.placement.WormPlacement
|
||||
|
||||
object MPlacementModifiers {
|
||||
@ -18,4 +20,6 @@ object MPlacementModifiers {
|
||||
val ENORMOUS by registry.register("enormous") { PlacementModifierType { EnormousPlacement.CODEC } }
|
||||
val ELLIPSOID_PLACEMENT by registry.register("ellipsoid") { PlacementModifierType { EllipsoidPlacement.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