Skip to content

Commit 490611c

Browse files
authored
Merge pull request #41 from dm432/feature/create-block-data
feat: Added a method to easily create block data for each custom block
2 parents bd0c114 + 68685e7 commit 490611c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/main/kotlin/de/danielmaile/mpp/block/BlockType.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ package de.danielmaile.mpp.block
1919

2020
import de.danielmaile.mpp.util.ToolType
2121
import org.bukkit.Instrument
22+
import org.bukkit.Material
2223
import org.bukkit.Note
2324
import org.bukkit.Sound
25+
import org.bukkit.block.data.BlockData
2426
import org.bukkit.block.data.type.NoteBlock
2527

2628
enum class BlockType(
@@ -148,6 +150,13 @@ enum class BlockType(
148150
val instrument: Instrument
149151
val note: Note
150152
val isPowered: Boolean
153+
val blockData: BlockData
154+
get() = Material.NOTE_BLOCK.createBlockData().apply {
155+
this as NoteBlock
156+
note = this@BlockType.note
157+
isPowered = this@BlockType.isPowered
158+
instrument = this@BlockType.instrument
159+
}
151160

152161
init {
153162
instrument = calculateInstrument()

0 commit comments

Comments
 (0)