net.minecraft.client.render.entity.EntityRenderer Java Examples

The following examples show how to use net.minecraft.client.render.entity.EntityRenderer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PonyRenderDispatcher.java    From MineLittlePony with MIT License 5 votes vote down vote up
/**
 *
 * Replaces an entity renderer depending on whether we want ponies or not.
 *
 * @param state   True if we want ponies (the original will be stored)
 * @param type    The type to replace
 * @param factory The replacement value
 * @param <T> The entity type
 */
@SuppressWarnings("unchecked")
<T extends Entity, V extends T> void switchRenderer(boolean state, EntityType<V> type, Function<EntityRenderDispatcher, EntityRenderer<T>> factory) {
    if (state) {
        if (!renderMap.containsKey(type)) {
            renderMap.put(type, ((MixinEntityRenderDispatcher)MinecraftClient.getInstance().getEntityRenderManager()).getEntityRenderers().get(type));
        }
        Mson.getInstance().getEntityRendererRegistry().registerEntityRenderer(type, factory);
    } else {
        if (renderMap.containsKey(type)) {
            Mson.getInstance().getEntityRendererRegistry().registerEntityRenderer(type, m -> (EntityRenderer<T>)renderMap.get(type));
        }
    }
}
 
Example #2
Source File: PonyRenderDispatcher.java    From MineLittlePony with MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Nullable
public <T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> IPonyRenderContext<T, M> getPonyRenderer(@Nullable T entity) {
    if (entity == null) {
        return null;
    }

    EntityRenderer<?> renderer = MinecraftClient.getInstance().getEntityRenderManager().getRenderer(entity);

    if (renderer instanceof IPonyRenderContext) {
        return (IPonyRenderContext<T, M>) renderer;
    }

    return null;
}
 
Example #3
Source File: IRenderFactory.java    From patchwork-api with GNU Lesser General Public License v2.1 votes vote down vote up
EntityRenderer<? super T> createRenderFor(EntityRenderDispatcher manager);