More or less actual tritanium worm placement configuration
This commit is contained in:
parent
88c3fe24b0
commit
df949a6861
@ -60,8 +60,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.ORE, OreConfiguration(target, 3)))
|
||||
context.register(ConfiguredFeatures.TRITANIUM_ORE_SMALL, ConfiguredFeature(MWorldGenFeatures.DEBUG_PLACEMENT, DebugPlacerFeature.Config(MBlocks.TRITANIUM_ORE.defaultBlockState())))
|
||||
context.register(ConfiguredFeatures.TRITANIUM_ORE_SMALL, ConfiguredFeature(Feature.ORE, OreConfiguration(target, 3)))
|
||||
//context.register(ConfiguredFeatures.TRITANIUM_ORE_SMALL, ConfiguredFeature(MWorldGenFeatures.DEBUG_PLACEMENT, DebugPlacerFeature.Config(MBlocks.TRITANIUM_ORE.defaultBlockState())))
|
||||
}
|
||||
|
||||
run {
|
||||
@ -122,9 +122,9 @@ fun registerPlacedFeatures(context: BootstrapContext<PlacedFeature>) {
|
||||
chunkScanRange = 24,
|
||||
seedMix = 9284343575495L,
|
||||
prePlacementModifiers = listOf(
|
||||
RarityFilter.onAverageOnceEvery(120),
|
||||
RarityFilter.onAverageOnceEvery(240),
|
||||
InSquarePlacement.spread(),
|
||||
HeightRangePlacement.of(StandardDeviationHeightProvider(VerticalAnchor.absolute(120), 15.0)),
|
||||
HeightRangePlacement.of(StandardDeviationHeightProvider(VerticalAnchor.absolute(-40), 15.0)),
|
||||
),
|
||||
postPlacementModifiers = listOf(
|
||||
EllipsoidPlacement(
|
||||
@ -144,7 +144,9 @@ fun registerPlacedFeatures(context: BootstrapContext<PlacedFeature>) {
|
||||
turnSpeedXZ = WormPlacement.constantTurnRate(10f),
|
||||
turnSpeedXY = WormPlacement.constantTurnRate(4f),
|
||||
turnChanceXY = BooleanProvider.Unbiased(6),
|
||||
turnChanceXZ = BooleanProvider.BiasedLinear(0.6f, 5)
|
||||
turnChanceXZ = BooleanProvider.BiasedLinear(0.6f, 5),
|
||||
maxTravelUp = 16,
|
||||
maxTravelDown = 16,
|
||||
)
|
||||
)
|
||||
))
|
||||
|
@ -1,5 +1,6 @@
|
||||
package ru.dbotthepony.mc.otm.worldgen.placement
|
||||
|
||||
import com.mojang.serialization.Codec
|
||||
import com.mojang.serialization.MapCodec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.core.BlockPos
|
||||
@ -16,6 +17,7 @@ import ru.dbotthepony.mc.otm.core.math.normalizeAngle
|
||||
import ru.dbotthepony.mc.otm.core.math.plus
|
||||
import ru.dbotthepony.mc.otm.core.math.toBlockPos
|
||||
import ru.dbotthepony.mc.otm.core.nextDouble
|
||||
import ru.dbotthepony.mc.otm.data.codec.minRange
|
||||
import ru.dbotthepony.mc.otm.data.world.BooleanProvider
|
||||
import ru.dbotthepony.mc.otm.registry.data.MPlacementModifiers
|
||||
import java.util.stream.Stream
|
||||
@ -35,6 +37,8 @@ class WormPlacement(
|
||||
val turnRateXZ: FloatProvider,
|
||||
val turnRateXY: FloatProvider,
|
||||
val initialAngleXY: FloatProvider = DEFAULT_INITIAL_ANGLE_XY,
|
||||
val maxTravelDown: Int = Int.MAX_VALUE,
|
||||
val maxTravelUp: Int = Int.MAX_VALUE,
|
||||
) : AbstractEnormousPlacement(parameters) {
|
||||
override fun getPositions(center: BlockPos, random: RandomSource): Stream<BlockPos> {
|
||||
var position = Vector.ZERO
|
||||
@ -102,6 +106,17 @@ class WormPlacement(
|
||||
|
||||
// advance worm
|
||||
position += Vector(xzCos, xySin, xzSin)
|
||||
|
||||
if (position.y > maxTravelUp) {
|
||||
xyTargetRotation = 0.0
|
||||
xySin = 0.0
|
||||
position = Vector(position.x, maxTravelUp.toDouble(), position.z)
|
||||
} else if (position.y < -maxTravelDown) {
|
||||
xyTargetRotation = 0.0
|
||||
xySin = 0.0
|
||||
position = Vector(position.x, -maxTravelDown.toDouble(), position.z)
|
||||
}
|
||||
|
||||
val calc = position.toBlockPos()
|
||||
|
||||
if (calc != prevPos) {
|
||||
@ -177,6 +192,8 @@ class WormPlacement(
|
||||
FloatProvider.CODEC.fieldOf("turn_rate_xz").forGetter(WormPlacement::turnRateXZ),
|
||||
FloatProvider.CODEC.fieldOf("turn_rate_xy").forGetter(WormPlacement::turnRateXY),
|
||||
FloatProvider.CODEC.optionalFieldOf("initial_angle_xy", DEFAULT_INITIAL_ANGLE_XY).forGetter(WormPlacement::initialAngleXY),
|
||||
Codec.INT.minRange(1).optionalFieldOf("max_travel_down", Int.MAX_VALUE).forGetter(WormPlacement::maxTravelDown),
|
||||
Codec.INT.minRange(1).optionalFieldOf("max_travel_up", Int.MAX_VALUE).forGetter(WormPlacement::maxTravelUp),
|
||||
).apply(it, ::WormPlacement)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user