Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Commit

Permalink
Materialでのアイテム配置でCustomModelDataに対応
Browse files Browse the repository at this point in the history
  • Loading branch information
sya-ri committed May 25, 2020
1 parent a743a4f commit 624c266
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/main/kotlin/me/syari/ss/core/inventory/CustomInventory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ class CustomInventory(val inventory: Inventory, private val id: List<String>) {
* 見た目のみのアイテムを配置します
* @param index アイテムの場所
* @param material アイテムタイプ
* @param customModelData カスタムモデルデータ
*/
fun item(index: Iterable<Int>, material: Material) {
val item = CustomItemStack.create(material, "").toOneItemStack
fun item(index: Iterable<Int>, material: Material, customModelData: Int? = null) {
val item = CustomItemStack.create(material, "").apply {
this.customModelData = customModelData
}.toOneItemStack
index.forEach {
item(it, item)
}
Expand All @@ -69,18 +72,20 @@ class CustomInventory(val inventory: Inventory, private val id: List<String>) {
* 見た目のみのアイテムを配置します
* @param index アイテムの場所
* @param material アイテムタイプ
* @param customModelData カスタムモデルデータ
*/
fun item(vararg index: Int, material: Material) {
item(index.toList(), material)
fun item(vararg index: Int, material: Material, customModelData: Int? = null) {
item(index.toList(), material, customModelData)
}

/**
* 見た目のみのアイテムを配置します
* @param index アイテムの場所
* @param material アイテムタイプ
* @param customModelData カスタムモデルデータ
*/
fun item(index: IntRange, material: Material) {
item(index.toList(), material)
fun item(index: IntRange, material: Material, customModelData: Int? = null) {
item(index.toList(), material, customModelData)
}

/**
Expand Down

0 comments on commit 624c266

Please sign in to comment.