Merge remote-tracking branch 'origin/1.21' into 1.21
This commit is contained in:
commit
2c741b45c3
@ -65,7 +65,7 @@ fun registerConfiguredFeatures(context: BootstrapContext<ConfiguredFeature<*, *>
|
|||||||
|
|
||||||
context.register(ConfiguredFeatures.BLACK_HOLE, ConfiguredFeature(
|
context.register(ConfiguredFeatures.BLACK_HOLE, ConfiguredFeature(
|
||||||
MWorldGenFeatures.BLACK_HOLE_PLACER,
|
MWorldGenFeatures.BLACK_HOLE_PLACER,
|
||||||
BlackHolePlacerFeature.Config(0.001f, Decimal("0.25"), Decimal(1))))
|
BlackHolePlacerFeature.Config(Decimal("0.25"), Decimal(1))))
|
||||||
}
|
}
|
||||||
|
|
||||||
private object PlacedFeatures {
|
private object PlacedFeatures {
|
||||||
@ -152,6 +152,7 @@ fun registerPlacedFeatures(context: BootstrapContext<PlacedFeature>) {
|
|||||||
context.register(PlacedFeatures.BLACK_HOLE, PlacedFeature(
|
context.register(PlacedFeatures.BLACK_HOLE, PlacedFeature(
|
||||||
blackHole,
|
blackHole,
|
||||||
listOf(
|
listOf(
|
||||||
|
RarityFilter.onAverageOnceEvery(1000),
|
||||||
InSquarePlacement.spread(),
|
InSquarePlacement.spread(),
|
||||||
HeightRangePlacement.uniform(VerticalAnchor.absolute(64), VerticalAnchor.absolute(128))
|
HeightRangePlacement.uniform(VerticalAnchor.absolute(64), VerticalAnchor.absolute(128))
|
||||||
)
|
)
|
||||||
|
@ -34,6 +34,10 @@ class CombinedContainer(containers: Stream<Pair<Container, Iterable<Int>>>) : IM
|
|||||||
override val container: Container
|
override val container: Container
|
||||||
get() = this@CombinedContainer
|
get() = this@CombinedContainer
|
||||||
|
|
||||||
|
override fun setChanged() {
|
||||||
|
outer.setChanged()
|
||||||
|
}
|
||||||
|
|
||||||
override fun component1(): Int {
|
override fun component1(): Int {
|
||||||
return super.component1()
|
return super.component1()
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,14 @@ inline fun <S : Slot> makeSlots(containers: List<Container>?, size: Int, initial
|
|||||||
open class MatterySlot(container: Container, index: Int, x: Int = 0, y: Int = 0) : Slot(container, index, x, y) {
|
open class MatterySlot(container: Container, index: Int, x: Int = 0, y: Int = 0) : Slot(container, index, x, y) {
|
||||||
var ignoreSpectators = true
|
var ignoreSpectators = true
|
||||||
|
|
||||||
|
override fun setChanged() {
|
||||||
|
if (container is IMatteryContainer) {
|
||||||
|
(container as IMatteryContainer).setChanged(containerSlot)
|
||||||
|
} else {
|
||||||
|
super.setChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun mayPickup(player: Player): Boolean {
|
override fun mayPickup(player: Player): Boolean {
|
||||||
return super.mayPickup(player) && (!ignoreSpectators || !player.isSpectator)
|
return super.mayPickup(player) && (!ignoreSpectators || !player.isSpectator)
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,12 @@ import ru.dbotthepony.mc.otm.registry.game.MBlocks
|
|||||||
object BlackHolePlacerFeature : Feature<BlackHolePlacerFeature.Config>(
|
object BlackHolePlacerFeature : Feature<BlackHolePlacerFeature.Config>(
|
||||||
RecordCodecBuilder.create {
|
RecordCodecBuilder.create {
|
||||||
it.group(
|
it.group(
|
||||||
Codec.floatRange(0.0F, 1.0F).fieldOf("chance").forGetter(Config::chance),
|
|
||||||
DecimalCodec.fieldOf("matter_min").forGetter(Config::minMatter),
|
DecimalCodec.fieldOf("matter_min").forGetter(Config::minMatter),
|
||||||
DecimalCodec.fieldOf("matter_max").forGetter(Config::maxMatter)
|
DecimalCodec.fieldOf("matter_max").forGetter(Config::maxMatter)
|
||||||
).apply(it, ::Config)
|
).apply(it, ::Config)
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
data class Config(val chance: Float, val minMatter: Decimal, val maxMatter: Decimal) : FeatureConfiguration
|
data class Config(val minMatter: Decimal, val maxMatter: Decimal) : FeatureConfiguration
|
||||||
|
|
||||||
override fun place(context: FeaturePlaceContext<Config>): Boolean {
|
override fun place(context: FeaturePlaceContext<Config>): Boolean {
|
||||||
val random = context.random()
|
val random = context.random()
|
||||||
@ -30,7 +29,7 @@ object BlackHolePlacerFeature : Feature<BlackHolePlacerFeature.Config>(
|
|||||||
|
|
||||||
val config = context.config()
|
val config = context.config()
|
||||||
|
|
||||||
if (level.getBlockState(pos).isAir && random.nextDouble() < config.chance.toDouble()) {
|
if (level.getBlockState(pos).isAir) {
|
||||||
if (level.setBlock(pos, MBlocks.BLACK_HOLE.defaultBlockState(), 2)) {
|
if (level.setBlock(pos, MBlocks.BLACK_HOLE.defaultBlockState(), 2)) {
|
||||||
val entity = level.getBlockEntity(pos)
|
val entity = level.getBlockEntity(pos)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user