aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/events/BakeExtraModelsEvent.kt
blob: 35bfecb9e4d223e033c2823ca74500c0fbdcc232 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package moe.nea.firmament.events

import java.util.function.BiConsumer
import net.minecraft.client.item.ItemAssetsLoader
import net.minecraft.client.render.model.ReferencedModelsCollector
import net.minecraft.client.util.ModelIdentifier
import net.minecraft.util.Identifier

// TODO: This event may be removed now since ItemAssetsLoader seems to load all item models now (probably to cope with servers setting the item_model component). Check whether this also applies to blocks now.
//@Deprecated(level = DeprecationLevel.ERROR, message = "This is no longer needed, since ItemAssetsLoader loads all item models.")
class BakeExtraModelsEvent(
	private val addAnyModel: BiConsumer<ModelIdentifier, Identifier>,
) : FirmamentEvent() {

	fun addNonItemModel(modelIdentifier: ModelIdentifier, identifier: Identifier) {
		this.addAnyModel.accept(modelIdentifier, identifier)
	}

	fun addItemModel(modelIdentifier: ModelIdentifier) {
	// TODO: If this is still needed: ItemAssetsLoader.FINDER
	//		addNonItemModel(
//			modelIdentifier,
//			modelIdentifier.id.withPrefixedPath())
	}

//	@Deprecated(level = DeprecationLevel.ERROR, message = "This is no longer needed, since ItemAssetsLoader loads all item models.")
	@Suppress("DEPRECATION")
	companion object : FirmamentEventBus<BakeExtraModelsEvent>()
}