Fix Cargo Crate being in wrong creative tabs
This commit is contained in:
parent
7c14614555
commit
5deb14f62f
@ -91,6 +91,9 @@ class WriteOnce<V> : ReadWriteProperty<Any, V> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Colored only
|
||||||
|
*/
|
||||||
@Suppress("PropertyName", "unused")
|
@Suppress("PropertyName", "unused")
|
||||||
open class ColoredDecorativeBlock(
|
open class ColoredDecorativeBlock(
|
||||||
val baseName: String,
|
val baseName: String,
|
||||||
@ -330,10 +333,14 @@ open class ColoredDecorativeBlock(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base + Colored
|
||||||
|
*/
|
||||||
class DecorativeBlock(
|
class DecorativeBlock(
|
||||||
baseName: String,
|
baseName: String,
|
||||||
private val provider: (DyeColor?) -> Block,
|
private val provider: (DyeColor?) -> Block,
|
||||||
itemGroup: CreativeModeTab = OverdriveThatMatters.INSTANCE.CREATIVE_TAB_DECORATIVE
|
itemGroup: CreativeModeTab = OverdriveThatMatters.INSTANCE.CREATIVE_TAB_DECORATIVE,
|
||||||
|
val baseItemGroup: CreativeModeTab = OverdriveThatMatters.INSTANCE.CREATIVE_TAB_DECORATIVE,
|
||||||
) : ColoredDecorativeBlock(baseName, provider, itemGroup) {
|
) : ColoredDecorativeBlock(baseName, provider, itemGroup) {
|
||||||
private var _block: RegistryObject<Block> by WriteOnce()
|
private var _block: RegistryObject<Block> by WriteOnce()
|
||||||
private var _item: RegistryObject<Item> by WriteOnce()
|
private var _item: RegistryObject<Item> by WriteOnce()
|
||||||
@ -394,7 +401,7 @@ class DecorativeBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun registerItems(registry: DeferredRegister<Item>) {
|
override fun registerItems(registry: DeferredRegister<Item>) {
|
||||||
_item = registry.register(baseName) { BlockItem(_block.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB_DECORATIVE).stacksTo(64)) }
|
_item = registry.register(baseName) { BlockItem(_block.get(), Item.Properties().tab(baseItemGroup).stacksTo(64)) }
|
||||||
|
|
||||||
super.registerItems(registry)
|
super.registerItems(registry)
|
||||||
}
|
}
|
||||||
@ -426,7 +433,7 @@ object MRegistry {
|
|||||||
research.build(event)
|
research.build(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
val CARGO_CRATES = DecorativeBlock(MNames.CARGO_CRATE, ::CargoCrateBlock, OverdriveThatMatters.INSTANCE.CREATIVE_TAB)
|
val CARGO_CRATES = DecorativeBlock(MNames.CARGO_CRATE, ::CargoCrateBlock, baseItemGroup = OverdriveThatMatters.INSTANCE.CREATIVE_TAB)
|
||||||
|
|
||||||
val TRITANIUM_BLOCK = DecorativeBlock.simple(MNames.TRITANIUM_BLOCK, {
|
val TRITANIUM_BLOCK = DecorativeBlock.simple(MNames.TRITANIUM_BLOCK, {
|
||||||
BlockBehaviour.Properties.of(Material.METAL, it?.materialColor ?: MaterialColor.COLOR_LIGHT_BLUE)
|
BlockBehaviour.Properties.of(Material.METAL, it?.materialColor ?: MaterialColor.COLOR_LIGHT_BLUE)
|
||||||
|
Loading…
Reference in New Issue
Block a user