net.minecraft.client.renderer.entity.RenderLivingBase Java Examples

The following examples show how to use net.minecraft.client.renderer.entity.RenderLivingBase. 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: SquashableMod.java    From CommunityMod with GNU Lesser General Public License v2.1 6 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void onRenderLivingPre(RenderLivingEvent.Pre<?> event) {
    EntityLivingBase entity = event.getEntity();
    Squashable squashable = entity.getCapability(squashableCap(), null);
    if (squashable == null) {
        return;
    }

    EnumFacing.Axis squashedAxis = squashable.getSquashedAxis();
    if (squashedAxis != null) {
        RenderLivingBase<?> renderer = event.getRenderer();
        originalModel = renderer.getMainModel();
        ModelHooks.setMainModel(renderer, new FlattenedModel(originalModel, squashedAxis));
    }
}
 
Example #2
Source File: SquashableMod.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static void setMainModel(RenderLivingBase<?> renderer, ModelBase model) {
    try {
        RENDERER_MODEL_FIELD.set(renderer, model);
    } catch (IllegalAccessException e) {
        throw new RuntimeException(e);
    }
}
 
Example #3
Source File: ProxyClient.java    From WearableBackpacks with MIT License 5 votes vote down vote up
/** Ensures that the specified entity class' renderer has a backpack layer - if possible. */
public static void ensureHasBackpackLayer(Class<? extends EntityLivingBase> entityClass) {
	if (!_hasLayerChecked.add(entityClass)) return;
	RenderManager manager = Minecraft.getMinecraft().getRenderManager();
	Render<?> render = manager.getEntityClassRenderObject(entityClass);
	if (!(render instanceof RenderLivingBase)) return;
	((RenderLivingBase<?>)render).addLayer(new RendererBackpack.Layer((RenderLivingBase<?>)render));
}
 
Example #4
Source File: ClientEventListener.java    From BetterChests with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void render(RenderLivingEvent.Pre<EntityLivingBase> event) throws NoSuchFieldException {
	EntityLivingBase entity = event.getEntity();

	if (entitiesWithBag.contains(entity.getEntityId())) {
		render = new LayerBag();
		if (renderLayers == null) {
			renderLayers = RenderLivingBase.class.getDeclaredField(MCPNames.field("field_177097_h"));
			renderLayers.setAccessible(true);
		}
		event.getRenderer().addLayer(render);
	}
}
 
Example #5
Source File: LayerTofunianHeldItem.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public LayerTofunianHeldItem(RenderLivingBase<?> livingEntityRendererIn)
{
    this.livingEntityRenderer = livingEntityRendererIn;
}
 
Example #6
Source File: RendererBackpack.java    From WearableBackpacks with MIT License 4 votes vote down vote up
public Layer(RenderLivingBase<?> livingEntityRendererIn)
{
    this.livingEntityRenderer = livingEntityRendererIn;
}