46 lines
2.1 KiB
Kotlin
46 lines
2.1 KiB
Kotlin
package net.shadowfacts.phycon.client
|
|
|
|
import net.fabricmc.fabric.api.client.model.ModelProviderContext
|
|
import net.fabricmc.fabric.api.client.model.ModelResourceProvider
|
|
import net.minecraft.client.render.model.UnbakedModel
|
|
import net.minecraft.resource.ResourceManager
|
|
import net.minecraft.util.DyeColor
|
|
import net.minecraft.util.Identifier
|
|
import net.shadowfacts.phycon.PhysicalConnectivity
|
|
import net.shadowfacts.phycon.client.model.ColoredCableModel
|
|
import net.shadowfacts.phycon.client.model.RedstoneControllerModel
|
|
import net.shadowfacts.phycon.client.model.SimpleFaceDeviceModel
|
|
|
|
/**
|
|
* @author shadowfacts
|
|
*/
|
|
class PhyModelProvider(resourceManager: ResourceManager) : ModelResourceProvider {
|
|
companion object {
|
|
val INTERFACE = Identifier(PhysicalConnectivity.MODID, "block/network_interface")
|
|
val INTERFACE_SIDE = Identifier(PhysicalConnectivity.MODID, "block/interface_side")
|
|
val REDSTONE_CONTROLLER = Identifier(PhysicalConnectivity.MODID, "block/redstone_controller")
|
|
val REDSTONE_EMITTER = Identifier(PhysicalConnectivity.MODID, "block/redstone_emitter")
|
|
val REDSTONE_EMITTER_SIDE = Identifier(PhysicalConnectivity.MODID, "block/redstone_emitter_side")
|
|
val EXTRACTOR = Identifier(PhysicalConnectivity.MODID, "block/extractor")
|
|
val EXTRACTOR_SIDE = Identifier(PhysicalConnectivity.MODID, "block/extractor_side")
|
|
val INSERTER = Identifier(PhysicalConnectivity.MODID, "block/inserter")
|
|
val INSERTER_SIDE = Identifier(PhysicalConnectivity.MODID, "block/inserter_side")
|
|
|
|
val CABLES = DyeColor.values().map {
|
|
Identifier(PhysicalConnectivity.MODID, "block/cable/${it.getName()}") to it
|
|
}.toMap()
|
|
}
|
|
|
|
override fun loadModelResource(resourceId: Identifier, context: ModelProviderContext): UnbakedModel? {
|
|
return when (resourceId) {
|
|
INTERFACE -> SimpleFaceDeviceModel(INTERFACE_SIDE)
|
|
REDSTONE_CONTROLLER -> RedstoneControllerModel
|
|
REDSTONE_EMITTER -> SimpleFaceDeviceModel(REDSTONE_EMITTER_SIDE)
|
|
EXTRACTOR -> SimpleFaceDeviceModel(EXTRACTOR_SIDE)
|
|
INSERTER -> SimpleFaceDeviceModel(INSERTER_SIDE)
|
|
in CABLES -> ColoredCableModel(CABLES[resourceId]!!)
|
|
else -> null
|
|
}
|
|
}
|
|
}
|