|
| 1 | +/* |
| 2 | + * Minecraft Forge, Patchwork Project |
| 3 | + * Copyright (c) 2016-2020, 2019-2020 |
| 4 | + * |
| 5 | + * This library is free software; you can redistribute it and/or |
| 6 | + * modify it under the terms of the GNU Lesser General Public |
| 7 | + * License as published by the Free Software Foundation version 2.1 |
| 8 | + * of the License. |
| 9 | + * |
| 10 | + * This library is distributed in the hope that it will be useful, |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | + * Lesser General Public License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU Lesser General Public |
| 16 | + * License along with this library; if not, write to the Free Software |
| 17 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | + */ |
| 19 | + |
| 20 | +package net.minecraftforge.fml.client.registry; |
| 21 | + |
| 22 | +import net.minecraft.client.render.entity.EntityRenderDispatcher; |
| 23 | +import net.minecraft.entity.Entity; |
| 24 | + |
| 25 | +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; |
| 26 | + |
| 27 | +public class RenderingRegistry { |
| 28 | + /** |
| 29 | + * Register an entity rendering handler. This will, after mod initialization, be inserted into the main |
| 30 | + * render map for entities. |
| 31 | + * Call this during {@link net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent}. |
| 32 | + * This method is safe to call during parallel mod loading. |
| 33 | + */ |
| 34 | + public static <T extends Entity> void registerEntityRenderingHandler(Class<T> entityClass, IRenderFactory<? super T> renderFactory) { |
| 35 | + EntityRendererRegistry.INSTANCE.register(entityClass, (dispatcher, context) -> renderFactory.createRenderFor(dispatcher)); |
| 36 | + } |
| 37 | + |
| 38 | + // This is here just in case a mod calls it, entity renderers are loaded by the Fabric API |
| 39 | + public static void loadEntityRenderers(EntityRenderDispatcher manager) { } |
| 40 | +} |
0 commit comments