Add passthrough placement modifier, and add argument-less placed feature builder
This commit is contained in:
parent
1e6e38ea7d
commit
e150b57b65
@ -56,7 +56,9 @@ object MBuiltInRegistries {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val FEATURE by Delegate(MRegistries.FEATURE)
|
val FEATURE by Delegate(MRegistries.FEATURE)
|
||||||
val PLACEMENT_MODIFIER by Delegate(MRegistries.PLACEMENT_MODIFIER)
|
val PLACEMENT_MODIFIER by Delegate(MRegistries.PLACEMENT_MODIFIER) {
|
||||||
|
defaultKey(ResourceLocation(OverdriveThatMatters.MOD_ID, "passthrough"))
|
||||||
|
}
|
||||||
|
|
||||||
internal fun register(bus: IEventBus) {
|
internal fun register(bus: IEventBus) {
|
||||||
delegates.forEach { bus.addListener(it::build) }
|
delegates.forEach { bus.addListener(it::build) }
|
||||||
|
@ -233,6 +233,8 @@ object EnhancedPlacedFeature : Feature<EnhancedPlacedFeature.Config>(
|
|||||||
private val children = ArrayList<Builder>()
|
private val children = ArrayList<Builder>()
|
||||||
private val contents: Either<EnhancedPlacementModifier, Holder<EnhancedFeature.Configured<*, *>>>
|
private val contents: Either<EnhancedPlacementModifier, Holder<EnhancedFeature.Configured<*, *>>>
|
||||||
|
|
||||||
|
constructor() : this(EnhancedPlacementModifier.Passthrough)
|
||||||
|
|
||||||
constructor(root: EnhancedPlacementModifier) {
|
constructor(root: EnhancedPlacementModifier) {
|
||||||
this.root = null
|
this.root = null
|
||||||
this.contents = Either.left(root)
|
this.contents = Either.left(root)
|
||||||
|
@ -39,11 +39,23 @@ interface EnhancedPlacementModifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object Passthrough : EnhancedPlacementModifier, Type<Passthrough> {
|
||||||
|
override fun evaluate(context: EnhancedPlacementContext, positions: Set<BlockPos>): Set<BlockPos> {
|
||||||
|
return positions
|
||||||
|
}
|
||||||
|
|
||||||
|
override val type: Type<*>
|
||||||
|
get() = this
|
||||||
|
|
||||||
|
override val codec: MapCodec<Passthrough> = MapCodec.unit(this)
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val registrar = MDeferredRegister(MRegistries.PLACEMENT_MODIFIER)
|
private val registrar = MDeferredRegister(MRegistries.PLACEMENT_MODIFIER)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
registrar.register("wrapper") { Wrapper.Companion }
|
registrar.register("wrapper") { Wrapper.Companion }
|
||||||
|
registrar.register("passthrough") { Passthrough }
|
||||||
}
|
}
|
||||||
|
|
||||||
val CODEC: Codec<EnhancedPlacementModifier> by lazy {
|
val CODEC: Codec<EnhancedPlacementModifier> by lazy {
|
||||||
|
Loading…
Reference in New Issue
Block a user