diff --git a/common/src/main/kotlin/quaedam/Quaedam.kt b/common/src/main/kotlin/quaedam/Quaedam.kt index 8a44ad8..79eab36 100644 --- a/common/src/main/kotlin/quaedam/Quaedam.kt +++ b/common/src/main/kotlin/quaedam/Quaedam.kt @@ -10,6 +10,7 @@ import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Items import quaedam.projection.ProjectionEffectType import quaedam.projection.SkylightProjection +import quaedam.projection.swarm.SwarmProjection import quaedam.projector.Projector object Quaedam { @@ -31,6 +32,7 @@ object Quaedam { fun init() { Projector SkylightProjection + SwarmProjection creativeModeTabs.register() items.register() diff --git a/common/src/main/kotlin/quaedam/projection/SkylightProjection.kt b/common/src/main/kotlin/quaedam/projection/SkylightProjection.kt index 90aad38..7b3274f 100644 --- a/common/src/main/kotlin/quaedam/projection/SkylightProjection.kt +++ b/common/src/main/kotlin/quaedam/projection/SkylightProjection.kt @@ -11,6 +11,7 @@ import quaedam.Quaedam object SkylightProjection { const val ID = "skylight_projection" + const val SHORT_ID = "skylight" val block = Quaedam.blocks.register(ID) { SkylightProjectionBlock }!! @@ -21,7 +22,7 @@ object SkylightProjection { ) }!! - val effect = Quaedam.projectionEffects.register(ID) { + val effect = Quaedam.projectionEffects.register(SHORT_ID) { ProjectionEffectType { SkylightProjectionEffect() } }!! @@ -39,15 +40,19 @@ object SkylightProjectionBlock : ProjectionBlock(creat data class SkylightProjectionEffect(var factor: Double = 2.0) : ProjectionEffect() { + companion object { + const val TAG_FACTOR = "Factor" + } + override val type get() = SkylightProjection.effect.get()!! override fun toNbt(tag: CompoundTag) { - tag.putDouble("Factor", factor) + tag.putDouble(TAG_FACTOR, factor) } override fun fromNbt(tag: CompoundTag) { - factor = tag.getDouble("Factor") + factor = tag.getDouble(TAG_FACTOR) } } diff --git a/common/src/main/kotlin/quaedam/projection/swarm/SwarmProjection.kt b/common/src/main/kotlin/quaedam/projection/swarm/SwarmProjection.kt new file mode 100644 index 0000000..b170922 --- /dev/null +++ b/common/src/main/kotlin/quaedam/projection/swarm/SwarmProjection.kt @@ -0,0 +1,26 @@ +package quaedam.projection.swarm + +import net.minecraft.world.item.BlockItem +import net.minecraft.world.item.Item +import quaedam.Quaedam +import quaedam.projection.ProjectionEffectType + +object SwarmProjection { + + const val ID = "swarm_projection" + const val SHORT_ID = "swarm" + + val block = Quaedam.blocks.register(ID) { SwarmProjectionBlock }!! + + val item = Quaedam.items.register(ID) { + BlockItem( + SwarmProjectionBlock, Item.Properties() + .`arch$tab`(Quaedam.creativeModeTab) + ) + }!! + + val effect = Quaedam.projectionEffects.register(SHORT_ID) { + ProjectionEffectType { SwarmProjectionEffect() } + }!! + +} \ No newline at end of file diff --git a/common/src/main/kotlin/quaedam/projection/swarm/SwarmProjectionBlock.kt b/common/src/main/kotlin/quaedam/projection/swarm/SwarmProjectionBlock.kt new file mode 100644 index 0000000..fc0fcce --- /dev/null +++ b/common/src/main/kotlin/quaedam/projection/swarm/SwarmProjectionBlock.kt @@ -0,0 +1,16 @@ +package quaedam.projection.swarm + +import net.minecraft.core.BlockPos +import net.minecraft.server.level.ServerLevel +import net.minecraft.world.level.block.state.BlockState +import quaedam.projection.ProjectionBlock + +object SwarmProjectionBlock : ProjectionBlock() { + + override fun createProjectionEffect( + level: ServerLevel, + state: BlockState, + pos: BlockPos + ) = SwarmProjectionEffect() + +} diff --git a/common/src/main/kotlin/quaedam/projection/swarm/SwarmProjectionEffect.kt b/common/src/main/kotlin/quaedam/projection/swarm/SwarmProjectionEffect.kt new file mode 100644 index 0000000..d9d7831 --- /dev/null +++ b/common/src/main/kotlin/quaedam/projection/swarm/SwarmProjectionEffect.kt @@ -0,0 +1,33 @@ +package quaedam.projection.swarm + +import net.minecraft.nbt.CompoundTag +import quaedam.projection.ProjectionEffect + +data class SwarmProjectionEffect( + var maxCount: Int = 10, + var withPlayer: Boolean = true, + var withVillager: Boolean = true +) : ProjectionEffect() { + + companion object { + const val TAG_MAX_COUNT = "MaxCount" + const val TAG_WITH_PLAYER = "WithPlayer" + const val TAG_WITH_VILLAGER = "WithVillager" + } + + override val type + get() = SwarmProjection.effect.get()!! + + override fun toNbt(tag: CompoundTag) { + tag.putInt(TAG_MAX_COUNT, maxCount) + tag.putBoolean(TAG_WITH_PLAYER, withPlayer) + tag.putBoolean(TAG_WITH_VILLAGER, withVillager) + } + + override fun fromNbt(tag: CompoundTag) { + maxCount = tag.getInt(TAG_MAX_COUNT) + withPlayer = tag.getBoolean(TAG_WITH_PLAYER) + withVillager = tag.getBoolean(TAG_WITH_VILLAGER) + } + +} diff --git a/common/src/main/resources/assets/quaedam/blockstates/swarm_projection.json b/common/src/main/resources/assets/quaedam/blockstates/swarm_projection.json new file mode 100644 index 0000000..25d0a22 --- /dev/null +++ b/common/src/main/resources/assets/quaedam/blockstates/swarm_projection.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "quaedam:block/swarm_projection" + } + } +} diff --git a/common/src/main/resources/assets/quaedam/lang/en_us.json b/common/src/main/resources/assets/quaedam/lang/en_us.json index ab70053..0255060 100644 --- a/common/src/main/resources/assets/quaedam/lang/en_us.json +++ b/common/src/main/resources/assets/quaedam/lang/en_us.json @@ -1,4 +1,6 @@ { "category.quaedam": "Quaedam", - "block.quaedam.projector": "Projector" + "block.quaedam.projector": "Projector", + "block.quaedam.skylight_projection": "Skylight Projection", + "block.quaedam.swarm_projection": "Swarm Projection" } \ No newline at end of file diff --git a/common/src/main/resources/assets/quaedam/models/block/swarm_projection.json b/common/src/main/resources/assets/quaedam/models/block/swarm_projection.json new file mode 100644 index 0000000..ddcfee1 --- /dev/null +++ b/common/src/main/resources/assets/quaedam/models/block/swarm_projection.json @@ -0,0 +1,6 @@ +{ + "parent": "quaedam:block/projection", + "textures": { + "ext": "quaedam:block/swarm_projection" + } +} diff --git a/common/src/main/resources/assets/quaedam/models/item/swarm_projection.json b/common/src/main/resources/assets/quaedam/models/item/swarm_projection.json new file mode 100644 index 0000000..57eb978 --- /dev/null +++ b/common/src/main/resources/assets/quaedam/models/item/swarm_projection.json @@ -0,0 +1,3 @@ +{ + "parent": "quaedam:block/swarm_projection" +} \ No newline at end of file diff --git a/common/src/main/resources/assets/quaedam/textures/block/swarm_projection.png b/common/src/main/resources/assets/quaedam/textures/block/swarm_projection.png new file mode 100644 index 0000000..8fd614d Binary files /dev/null and b/common/src/main/resources/assets/quaedam/textures/block/swarm_projection.png differ