feat: register noise projection
This commit is contained in:
parent
718bcd1c4f
commit
e15a099678
@ -9,10 +9,7 @@ import net.minecraft.world.item.CreativeModeTab
|
|||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.item.Items
|
import net.minecraft.world.item.Items
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import quaedam.projection.ProjectionCommand
|
import quaedam.projection.*
|
||||||
import quaedam.projection.ProjectionEffectType
|
|
||||||
import quaedam.projection.SkylightProjection
|
|
||||||
import quaedam.projection.SoundProjection
|
|
||||||
import quaedam.projection.swarm.SwarmProjection
|
import quaedam.projection.swarm.SwarmProjection
|
||||||
import quaedam.projector.Projector
|
import quaedam.projector.Projector
|
||||||
|
|
||||||
@ -44,6 +41,7 @@ object Quaedam {
|
|||||||
SkylightProjection
|
SkylightProjection
|
||||||
SwarmProjection
|
SwarmProjection
|
||||||
SoundProjection
|
SoundProjection
|
||||||
|
NoiseProjection
|
||||||
ProjectionCommand
|
ProjectionCommand
|
||||||
|
|
||||||
creativeModeTabs.register()
|
creativeModeTabs.register()
|
||||||
|
58
common/src/main/kotlin/quaedam/projection/NoiseProjection.kt
Normal file
58
common/src/main/kotlin/quaedam/projection/NoiseProjection.kt
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
package quaedam.projection
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.nbt.CompoundTag
|
||||||
|
import net.minecraft.server.level.ServerLevel
|
||||||
|
import net.minecraft.world.item.BlockItem
|
||||||
|
import net.minecraft.world.item.Item
|
||||||
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
|
import quaedam.Quaedam
|
||||||
|
|
||||||
|
object NoiseProjection {
|
||||||
|
|
||||||
|
const val ID = "noise_projection"
|
||||||
|
const val SHORT_ID = "noise"
|
||||||
|
|
||||||
|
val block = Quaedam.blocks.register(ID) { NoiseProjectionBlock }!!
|
||||||
|
|
||||||
|
val item = Quaedam.items.register(ID) {
|
||||||
|
BlockItem(
|
||||||
|
NoiseProjectionBlock, Item.Properties()
|
||||||
|
.`arch$tab`(Quaedam.creativeModeTab)
|
||||||
|
)
|
||||||
|
}!!
|
||||||
|
|
||||||
|
val effect = Quaedam.projectionEffects.register(SHORT_ID) {
|
||||||
|
ProjectionEffectType { NoiseProjectionEffect() }
|
||||||
|
}!!
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
object NoiseProjectionBlock : ProjectionBlock<NoiseProjectionEffect>(createProperties().lightLevel { 3 }) {
|
||||||
|
|
||||||
|
override fun createProjectionEffect(
|
||||||
|
level: ServerLevel,
|
||||||
|
state: BlockState,
|
||||||
|
pos: BlockPos
|
||||||
|
) = NoiseProjectionEffect()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
data class NoiseProjectionEffect(var amount: Int = 5) : ProjectionEffect() {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val TAG_AMOUNT = "Amount"
|
||||||
|
}
|
||||||
|
|
||||||
|
override val type
|
||||||
|
get() = SoundProjection.effect.get()!!
|
||||||
|
|
||||||
|
override fun toNbt(tag: CompoundTag) {
|
||||||
|
tag.putInt(TAG_AMOUNT, amount)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun fromNbt(tag: CompoundTag) {
|
||||||
|
amount = tag.getInt(TAG_AMOUNT)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user