|
| 1 | +/* |
| 2 | + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package net.fabricmc.fabric.api.client.rendering.v1; |
| 18 | + |
| 19 | +import net.minecraft.block.Block; |
| 20 | +import net.minecraft.client.color.block.BlockColorProvider; |
| 21 | +import net.minecraft.client.color.item.ItemColorProvider; |
| 22 | +import net.minecraft.item.ItemConvertible; |
| 23 | + |
| 24 | +import net.fabricmc.fabric.impl.client.rendering.ColorProviderRegistryImpl; |
| 25 | + |
| 26 | +public interface ColorProviderRegistry<T, Provider> { |
| 27 | + ColorProviderRegistry<ItemConvertible, ItemColorProvider> ITEM = ColorProviderRegistryImpl.ITEM; |
| 28 | + |
| 29 | + ColorProviderRegistry<Block, BlockColorProvider> BLOCK = ColorProviderRegistryImpl.BLOCK; |
| 30 | + |
| 31 | + /** |
| 32 | + * Register a color provider for one or more objects. |
| 33 | + * |
| 34 | + * @param provider The color provider to register. |
| 35 | + * @param objects The objects which should be colored using this provider. |
| 36 | + */ |
| 37 | + void register(Provider provider, T... objects); |
| 38 | + |
| 39 | + /** |
| 40 | + * Get a color provider for the given object. |
| 41 | + * |
| 42 | + * <p>Please note that the underlying registry may not be fully populated or stable until the game has started, |
| 43 | + * as other mods may overwrite the registry. |
| 44 | + * |
| 45 | + * @param object The object to acquire the provide for. |
| 46 | + * @return The registered mapper for this provider, or {@code null} if none is registered or available. |
| 47 | + */ |
| 48 | + Provider get(T object); |
| 49 | +} |
0 commit comments