feat: abstract projection block

This commit is contained in:
xtex 2023-06-29 22:30:49 +08:00
parent 76be0de81e
commit 81735d5f12
Signed by: xtex
GPG Key ID: B918086ED8045B91
9 changed files with 76 additions and 1 deletions

View File

@ -33,7 +33,7 @@ object ProjectorBlock : Block(Properties.of()
.lightLevel { 3 }
.mapColor(MapColor.COLOR_BLACK)
.randomTicks()
.destroyTime(4.0f)
.strength(4.0f)
.requiresCorrectToolForDrops()) {
override fun use(

View File

@ -0,0 +1,22 @@
package quaedam.projection
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.material.MapColor
import net.minecraft.world.level.storage.loot.LootParams
abstract class ProjectionBlock(properties: Properties = createProperties()) : Block(properties) {
companion object {
fun createProperties(): Properties = Properties.of()
.strength(3.5f)
.requiresCorrectToolForDrops()
.mapColor(MapColor.COLOR_GRAY)
}
@Suppress("OVERRIDE_DEPRECATION")
override fun getDrops(blockState: BlockState, builder: LootParams.Builder) = listOf(ItemStack(asItem()))
}

View File

@ -0,0 +1,33 @@
package quaedam.projection
import net.minecraft.core.BlockPos
import net.minecraft.world.InteractionHand
import net.minecraft.world.InteractionResult
import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.BlockItem
import net.minecraft.world.item.Item
import net.minecraft.world.level.Level
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.material.MapColor
import net.minecraft.world.phys.BlockHitResult
import quaedam.Quaedam
object SkylightProjection {
const val ID = "skylight_projection"
val block = Quaedam.blocks.register(ID) { SkylightProjectionBlock }
val item = Quaedam.items.register(ID) {
BlockItem(
SkylightProjectionBlock, Item.Properties()
.`arch$tab`(Quaedam.creativeModeTab)
)
}!!
}
object SkylightProjectionBlock : ProjectionBlock(createProperties().lightLevel { 3 }) {
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quaedam:block/skylight_projection"
}
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "quaedam:block/projection",
"up": "#ext"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "quaedam:block/projection",
"textures": {
"ext": "quaedam:block/skylight_projection"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B