Add missing methods to StripedColoredDecorativeBlock
This commit is contained in:
parent
d3166894f3
commit
a34930a310
@ -25,9 +25,37 @@ class StripedColoredDecorativeBlock(
|
||||
private val mapItems = EnumMap<DyeColor, EnumMap<DyeColor, RegistryObject<Item>>>(DyeColor::class.java)
|
||||
|
||||
fun getBlockNullable(base: DyeColor, stripe: DyeColor): Block? {
|
||||
if (!registeredBlocks) {
|
||||
throw IllegalStateException("Not yet registered blocks")
|
||||
}
|
||||
|
||||
return mapBlocks.get(base)?.get(stripe)?.get()
|
||||
}
|
||||
|
||||
fun getItemNullable(base: DyeColor, stripe: DyeColor): Item? {
|
||||
if (!registeredItems) {
|
||||
throw IllegalStateException("Not yet registered items")
|
||||
}
|
||||
|
||||
return mapItems.get(base)?.get(stripe)?.get()
|
||||
}
|
||||
|
||||
fun getBlock(base: DyeColor, stripe: DyeColor): Block {
|
||||
if (!registeredBlocks) {
|
||||
throw IllegalStateException("Not yet registered blocks")
|
||||
}
|
||||
|
||||
return mapBlocks.get(base)?.get(stripe)?.get() ?: throw NoSuchElementException("$base colored $stripe striped block does not exist")
|
||||
}
|
||||
|
||||
fun getItem(base: DyeColor, stripe: DyeColor): Item {
|
||||
if (!registeredItems) {
|
||||
throw IllegalStateException("Not yet registered items")
|
||||
}
|
||||
|
||||
return mapItems.get(base)?.get(stripe)?.get() ?: throw NoSuchElementException("$base colored $stripe striped item does not exist")
|
||||
}
|
||||
|
||||
var registeredItems = false
|
||||
private set
|
||||
|
||||
@ -88,7 +116,7 @@ class StripedColoredDecorativeBlock(
|
||||
|
||||
val mappedItems: Map<DyeColor, Map<DyeColor, Item>> by lazy {
|
||||
if (!registeredItems) {
|
||||
throw IllegalStateException("Not yet registered blocks")
|
||||
throw IllegalStateException("Not yet registered items")
|
||||
}
|
||||
|
||||
val builder = ImmutableMap.Builder<DyeColor, Map<DyeColor, Item>>()
|
||||
|
Loading…
Reference in New Issue
Block a user