@SubscribeEvent(priority = EventPriority.HIGHEST) public void onInitGuiPost(GuiScreenEvent.InitGuiEvent.Post event) { if(!hasShownFirstGui) { hasShownFirstGui = true; //Add the layer renderers Render renderer = Minecraft.getMinecraft().getRenderManager().getEntityClassRenderObject(EntityLlama.class); if(renderer instanceof RenderLlama) { RenderLlama renderLlama = (RenderLlama)renderer; renderLlama.addLayer(new LayerFancyLlama(renderLlama)); } } }
private static void renderArm(EnumHandSide p_187455_1_) { Minecraft mc = Minecraft.getMinecraft(); mc.getTextureManager().bindTexture(mc.player.getLocationSkin()); Render<AbstractClientPlayer> render = mc.getRenderManager() .<AbstractClientPlayer>getEntityRenderObject(mc.player); RenderPlayer renderplayer = (RenderPlayer) render; GlStateManager.pushMatrix(); float f = p_187455_1_ == EnumHandSide.RIGHT ? 1.0F : -1.0F; GlStateManager.rotate(92.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(f * -41.0F, 0.0F, 0.0F, 1.0F); GlStateManager.translate(f * 0.3F, -1.1F, 0.45F); if (p_187455_1_ == EnumHandSide.RIGHT) { renderplayer.renderRightArm(mc.player); } else { renderplayer.renderLeftArm(mc.player); } GlStateManager.popMatrix(); }
private void func_178095_a(AbstractClientPlayer clientPlayer, float p_178095_2_, float p_178095_3_) { float f = -0.3F * MathHelper.sin(MathHelper.sqrt_float(p_178095_3_) * (float)Math.PI); float f1 = 0.4F * MathHelper.sin(MathHelper.sqrt_float(p_178095_3_) * (float)Math.PI * 2.0F); float f2 = -0.4F * MathHelper.sin(p_178095_3_ * (float)Math.PI); GlStateManager.translate(f, f1, f2); GlStateManager.translate(0.64000005F, -0.6F, -0.71999997F); GlStateManager.translate(0.0F, p_178095_2_ * -0.6F, 0.0F); GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); float f3 = MathHelper.sin(p_178095_3_ * p_178095_3_ * (float)Math.PI); float f4 = MathHelper.sin(MathHelper.sqrt_float(p_178095_3_) * (float)Math.PI); GlStateManager.rotate(f4 * 70.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(f3 * -20.0F, 0.0F, 0.0F, 1.0F); this.mc.getTextureManager().bindTexture(clientPlayer.getLocationSkin()); GlStateManager.translate(-1.0F, 3.6F, 3.5F); GlStateManager.rotate(120.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(200.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(1.0F, 1.0F, 1.0F); GlStateManager.translate(5.6F, 0.0F, 0.0F); Render<AbstractClientPlayer> render = this.renderManager.<AbstractClientPlayer>getEntityRenderObject(this.mc.thePlayer); GlStateManager.disableCull(); RenderPlayer renderplayer = (RenderPlayer)render; renderplayer.renderRightArm(this.mc.thePlayer); GlStateManager.enableCull(); }
private void func_178095_a(AbstractClientPlayer clientPlayer, float p_178095_2_, float p_178095_3_) { float f = -0.3F * MathHelper.sin(MathHelper.sqrt_float(p_178095_3_) * (float)Math.PI); float f1 = 0.4F * MathHelper.sin(MathHelper.sqrt_float(p_178095_3_) * (float)Math.PI * 2.0F); float f2 = -0.4F * MathHelper.sin(p_178095_3_ * (float)Math.PI); GlStateManager.translate(f, f1, f2); GlStateManager.translate(0.64000005F, -0.6F, -0.71999997F); GlStateManager.translate(0.0F, p_178095_2_ * -0.6F, 0.0F); GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); float f3 = MathHelper.sin(p_178095_3_ * p_178095_3_ * (float)Math.PI); float f4 = MathHelper.sin(MathHelper.sqrt_float(p_178095_3_) * (float)Math.PI); GlStateManager.rotate(f4 * 70.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(f3 * -20.0F, 0.0F, 0.0F, 1.0F); this.mc.getTextureManager().bindTexture(clientPlayer.getLocationSkin()); GlStateManager.translate(-1.0F, 3.6F, 3.5F); GlStateManager.rotate(120.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(200.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(1.0F, 1.0F, 1.0F); GlStateManager.translate(5.6F, 0.0F, 0.0F); Render render = this.renderManager.getEntityRenderObject(this.mc.thePlayer); GlStateManager.disableCull(); RenderPlayer renderplayer = (RenderPlayer)render; renderplayer.renderRightArm(this.mc.thePlayer); GlStateManager.enableCull(); }
public static void resetDisplayListModels() { if (needResetModels) { needResetModels = false; SMCLog.info("Reset model renderers"); for (Render render : mc.getRenderManager().getEntityRenderMap().values()) { if (render instanceof RenderLiving) { RenderLiving renderliving = (RenderLiving)render; resetDisplayListModel(renderliving.getMainModel()); } } } }
private void renderArm(EnumHandSide p_187455_1_) { this.mc.getTextureManager().bindTexture(this.mc.player.getLocationSkin()); Render<AbstractClientPlayer> render = this.renderManager.<AbstractClientPlayer>getEntityRenderObject(this.mc.player); RenderPlayer renderplayer = (RenderPlayer)render; GlStateManager.pushMatrix(); float f = p_187455_1_ == EnumHandSide.RIGHT ? 1.0F : -1.0F; GlStateManager.rotate(92.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(f * -41.0F, 0.0F, 0.0F, 1.0F); GlStateManager.translate(f * 0.3F, -1.1F, 0.45F); if (p_187455_1_ == EnumHandSide.RIGHT) { renderplayer.renderRightArm(this.mc.player); } else { renderplayer.renderLeftArm(this.mc.player); } GlStateManager.popMatrix(); }
private void renderArm(EnumHandSide p_187455_1_) { this.mc.getTextureManager().bindTexture(this.mc.thePlayer.getLocationSkin()); Render<AbstractClientPlayer> render = this.renderManager.<AbstractClientPlayer>getEntityRenderObject(this.mc.thePlayer); RenderPlayer renderplayer = (RenderPlayer)render; GlStateManager.pushMatrix(); float f = p_187455_1_ == EnumHandSide.RIGHT ? 1.0F : -1.0F; GlStateManager.rotate(92.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(f * -41.0F, 0.0F, 0.0F, 1.0F); GlStateManager.translate(f * 0.3F, -1.1F, 0.45F); if (p_187455_1_ == EnumHandSide.RIGHT) { renderplayer.renderRightArm(this.mc.thePlayer); } else { renderplayer.renderLeftArm(this.mc.thePlayer); } GlStateManager.popMatrix(); }
@SubscribeEvent(priority = EventPriority.HIGHEST) public void onInitGuiPost(GuiScreenEvent.InitGuiEvent.Post event) { if(!hasShownFirstGui) { hasShownFirstGui = true; //Add the layer renderers Render renderer = Minecraft.getMinecraft().getRenderManager().getEntityClassRenderObject(EntityRabbit.class); if(renderer instanceof RenderRabbit) { RenderRabbit renderRabbit = (RenderRabbit)renderer; renderRabbit.addLayer(new LayerFancyBunny(renderRabbit)); } } }
@Override public void preInit(FMLPreInitializationEvent evt) { MCDoom.instance.getGoreProperty().setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); MCDoom.instance.getMaxGoreParticles().setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); MinecraftForge.EVENT_BUS.register(screenEventHandler); MinecraftForge.EVENT_BUS.register(soundEventsHandler); registerItems(); RenderingRegistry.registerEntityRenderingHandler(PlasmaBallEntity.class, new IRenderFactory<PlasmaBallEntity>() { @Override public Render<? super PlasmaBallEntity> createRenderFor(RenderManager manager) { return new RenderPlasmaBall(manager); } }); loadWeaponRenderers(); }
public static <ENTITY extends Entity> void register(Class<ENTITY> classes, final Class<? extends Render<ENTITY>> render) { RenderingRegistry.registerEntityRenderingHandler(classes, new IRenderFactory<ENTITY>() { @Override public Render<ENTITY> createRenderFor(RenderManager manager) { try { return render.getConstructor(RenderManager.class).newInstance(manager); } catch (Exception e) { e.printStackTrace(); } return null; } }); }
void injectModel(EntityPlayer player) { Minecraft mc = Minecraft.getMinecraft(); Render<EntityPlayer> pr = mc.getRenderManager().getEntityRenderObject(player); if (!((Render) pr instanceof RenderPlayer)) { if (!invalid) { Core.logWarning("Unable to patch Player model!"); } invalid = true; return; } RenderPlayer playerRenderer = (RenderPlayer) (Render) pr; ModelRenderer head = playerRenderer.getMainModel().bipedHead; if (head.childModels != null) { for (Iterator<ModelRenderer> it = head.childModels.iterator(); it.hasNext(); ) { ModelRenderer child = it.next(); if (child instanceof LmpMaskRenderer) { it.remove(); } } } head.addChild(new LmpMaskRenderer(playerRenderer.getMainModel())); }
@SideOnly (Side.CLIENT) public static void sanitizeEntityRenderers(RenderManager renderManager) { if (!hasSanitized) { try { for (Render<? extends Entity> render : renderManager.entityRenderMap.values()) { if (render != null) { for (Field field : render.getClass().getDeclaredFields()) { if (field.getType().equals(RenderItem.class)) { field.setAccessible(true); field.set(render, CCRenderItem.getOverridenRenderItem()); } } } } } catch (Exception e) { throw new RuntimeException("Unable to reflect an EntityRenderer!", e); } hasSanitized = true; } }
@SuppressWarnings("unchecked") private static RenderPlayer getOldRenderer(String keyword) { RenderManager manager = Minecraft.getMinecraft().getRenderManager(); Map< Class <? extends Entity > , Render<? extends Entity >> entityRenderMap = manager.entityRenderMap; for(Field field : manager.getClass().getDeclaredFields()) { if(field.getType() == Map.class) { field.setAccessible(true); try { Object obj = field.get(manager); if(obj == entityRenderMap) { continue; } Map<String, RenderPlayer> skinMap = (Map<String, RenderPlayer>) obj; return skinMap.get(keyword); } catch (IllegalAccessException e) { InfinityLib.instance.getLogger().printStackTrace(e); } } } return null; }
@Override public Render<E> createRenderFor(RenderManager manager) { try { return renderClass.getConstructor(RenderManager.class).newInstance(manager); } catch (Exception e) { throw new RuntimeException(e); } }
private void setRenderHead(EntityLivingBase entity, boolean setRender) { if (entity.getItemStackFromSlot(EntityEquipmentSlot.HEAD).getItem() == Itemss.PNEUMATIC_HELMET && (ConfigHandler.client.useHelmetModel || DateEventHandler.isIronManEvent())) { Render renderer = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(entity); if (renderer instanceof RenderBiped) { ModelBiped modelBiped = (ModelBiped) ((RenderBiped) renderer).getMainModel(); modelBiped.bipedHead.showModel = setRender; } } }
@Redirect(method = "doRenderEntity(Lnet/minecraft/entity/Entity;DDDFFZ)V", at = @At(value = "INVOKE", target = "net/minecraft/client/renderer/entity/Render.doRender(Lnet/minecraft/entity/Entity;DDDFF)V")) @SuppressWarnings("unchecked") private void doRender(Render render, Entity entity, double x, double y, double z, float entityYaw, float partialTicks) { EntityRenderEvent event = new EntityRenderEvent(EventState.PRE, render, entity, x, y, z, entityYaw, partialTicks); ClientAPI.EVENT_BUS.post(event); if (!event.isCancelled()) render.doRender(entity, x, y, z, entityYaw, partialTicks); ClientAPI.EVENT_BUS.post(new EntityRenderEvent(EventState.POST, render, entity, x, y, x, entityYaw, partialTicks)); }
public EntityRenderEvent(EventState state, Render<?> renderer, Entity entity, double x, double y, double z, float entityYaw, float partialTicks) { this.state = state; this.renderer = renderer; this.entity = entity; this.x = x; this.y = y; this.z = z; this.entityYaw = entityYaw; this.partialTicks = partialTicks; }
@SideOnly(Side.CLIENT) public static void registerEntityRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityMobTest.class, new IRenderFactory() { @Override public Render createRenderFor(RenderManager manager) { return new RenderMobTest(manager, new ModelMobTest(), 0.4F); }}); }
@SideOnly(Side.CLIENT) public static void initModels() { RenderingRegistry.registerEntityRenderingHandler(EntityMeeCreeps.class, RenderMeeCreeps.FACTORY); RenderingRegistry.registerEntityRenderingHandler(EntityProjectile.class, new IRenderFactory<EntityProjectile>() { @Override public Render<? super EntityProjectile> createRenderFor(RenderManager manager) { return new RenderProjectile<EntityProjectile>(manager, Minecraft.getMinecraft().getRenderItem()); } }); }
private void renderPlayerArms(AbstractClientPlayer clientPlayer) { this.mc.getTextureManager().bindTexture(clientPlayer.getLocationSkin()); Render<AbstractClientPlayer> render = this.renderManager.<AbstractClientPlayer>getEntityRenderObject(this.mc.thePlayer); RenderPlayer renderplayer = (RenderPlayer)render; if (!clientPlayer.isInvisible()) { GlStateManager.disableCull(); this.renderRightArm(renderplayer); this.renderLeftArm(renderplayer); GlStateManager.enableCull(); } }
private void renderPlayerArms(AbstractClientPlayer clientPlayer) { this.mc.getTextureManager().bindTexture(clientPlayer.getLocationSkin()); Render render = this.renderManager.getEntityRenderObject(this.mc.thePlayer); RenderPlayer renderplayer = (RenderPlayer)render; if (!clientPlayer.isInvisible()) { GlStateManager.disableCull(); this.renderRightArm(renderplayer); this.renderLeftArm(renderplayer); GlStateManager.enableCull(); } }
@Override public Render<? super T> createRenderFor(RenderManager renderManager) { try { return renderClass.getConstructor(RenderManager.class).newInstance(renderManager); } catch (Exception ex) { HalloweenMod.LOGGER.catching(ex); return null; } }
public IEntityRenderer makeEntityRender(ModelBase modelBase, float shadowSize) { RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); Render render = (Render)rendermanager.getEntityRenderMap().get(EntityEnderCrystal.class); if (!(render instanceof RenderEnderCrystal)) { Config.warn("Not an instance of RenderEnderCrystal: " + render); return null; } else { RenderEnderCrystal renderendercrystal = (RenderEnderCrystal)render; if (!Reflector.RenderEnderCrystal_modelEnderCrystalNoBase.exists()) { Config.warn("Field not found: RenderEnderCrystal.modelEnderCrystalNoBase"); return null; } else { Reflector.setFieldValue(renderendercrystal, Reflector.RenderEnderCrystal_modelEnderCrystalNoBase, modelBase); renderendercrystal.shadowSize = shadowSize; return renderendercrystal; } } }
public IEntityRenderer makeEntityRender(ModelBase modelBase, float shadowSize) { RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); Render render = (Render)rendermanager.getEntityRenderMap().get(EntitySheep.class); if (!(render instanceof RenderSheep)) { Config.warn("Not a RenderSheep: " + render); return null; } else { if (render.getEntityClass() == null) { RenderSheep rendersheep = new RenderSheep(rendermanager); rendersheep.mainModel = new ModelSheep2(); rendersheep.shadowSize = 0.7F; render = rendersheep; } RenderSheep rendersheep1 = (RenderSheep)render; List<LayerRenderer<EntitySheep>> list = rendersheep1.getLayerRenderers(); Iterator iterator = list.iterator(); while (iterator.hasNext()) { LayerRenderer layerrenderer = (LayerRenderer)iterator.next(); if (layerrenderer instanceof LayerSheepWool) { iterator.remove(); } } LayerSheepWool layersheepwool = new LayerSheepWool(rendersheep1); layersheepwool.sheepModel = (ModelSheep1)modelBase; rendersheep1.addLayer(layersheepwool); return rendersheep1; } }
public IEntityRenderer makeEntityRender(ModelBase modelBase, float shadowSize) { RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); Render render = (Render)rendermanager.getEntityRenderMap().get(EntityEnderCrystal.class); if (!(render instanceof RenderEnderCrystal)) { Config.warn("Not an instance of RenderEnderCrystal: " + render); return null; } else { RenderEnderCrystal renderendercrystal = (RenderEnderCrystal)render; if (!Reflector.RenderEnderCrystal_modelEnderCrystal.exists()) { Config.warn("Field not found: RenderEnderCrystal.modelEnderCrystal"); return null; } else { Reflector.setFieldValue(renderendercrystal, Reflector.RenderEnderCrystal_modelEnderCrystal, modelBase); renderendercrystal.shadowSize = shadowSize; return renderendercrystal; } } }
@Override public void preInit(FMLPreInitializationEvent e) { super.preInit(e); registerTileEntitySpecialRenderers(); RenderingRegistry.registerEntityRenderingHandler(EntityThrownKnife.class, new IRenderFactory<EntityThrownKnife>() { @Override public Render<EntityThrownKnife> createRenderFor(RenderManager manager) { return new RenderThrownKnife(manager, mc.getRenderItem()); } }); }
public static void loadEntityRenderers(RenderManager manager, Map<Class<? extends Entity> , Render<? extends Entity>> renderMap) { for (Map.Entry<Class<? extends Entity>, IRenderFactory<? extends Entity>> entry : INSTANCE.entityRenderers.entrySet()) { register(manager, renderMap, entry.getKey(), entry.getValue()); } }
@SideOnly(Side.CLIENT) public static void initRenderer() { // RenderingRegistry.registerEntityRenderingHandler(EntityFallingFreshWaterBlock.class, new RenderFallingFreshWaterBlock(Minecraft.getMinecraft().getRenderManager())); RenderingRegistry.registerEntityRenderingHandler(EntityFallingFreshWaterBlock.class, new IRenderFactory<EntityFallingFreshWaterBlock>() { @Override public Render<? super EntityFallingFreshWaterBlock> createRenderFor(RenderManager manager) { System.out.println("FluidSetup.createRenderFor"); return new RenderFallingFreshWaterBlock(manager); } }); }
public void loadEntityRenderers(Map<Class<? extends Entity>, Render> rendererMap) { for (EntityRendererInfo info : entityRenderers) { rendererMap.put(info.target, info.renderer); info.renderer.func_76976_a(RenderManager.field_78727_a); } }
/** * Get the renderer's texture * * Very hard stuff are going on here */ @SideOnly(Side.CLIENT) @SuppressWarnings({"unchecked", "rawtypes"}) protected void setupTexture() { Class<Render> clazz = (Class<Render>) this.renderer.getClass(); for (Method method : clazz.getDeclaredMethods()) { Class[] args = method.getParameterTypes(); boolean hasEntityArg = args.length == 1 && args[0].isAssignableFrom(Entity.class); boolean returnsRL = method.getReturnType().isAssignableFrom(ResourceLocation.class); if (hasEntityArg && returnsRL) { try { method.setAccessible(true); this.texture = (ResourceLocation) method.invoke(this.renderer, this.entity); } catch (Exception e) { Metamorph.log("Failed to get texture of a morph '" + this.name + "'!"); e.printStackTrace(); } break; } } }
private void setupEntityHack() { RenderingRegistry.registerEntityRenderingHandler(EntityHack.class, new IRenderFactory<EntityHack>() { @Override public Render<? super EntityHack> createRenderFor(RenderManager manager) { return new EntityHackRender(manager); } }); }
public static void registerRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityPawn.class, new IRenderFactory<EntityPawn>() { @Override public Render<EntityPawn> createRenderFor(RenderManager manager) { return new RenderPawn(manager); } }); }
public static void registerRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityKnight.class, new IRenderFactory<EntityKnight>() { @Override public Render<EntityKnight> createRenderFor(RenderManager manager) { return new RenderKnight(manager); } }); }
public static void registerRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityBishop.class, new IRenderFactory<EntityBishop>() { @Override public Render<EntityBishop> createRenderFor(RenderManager manager) { return new RenderBishop(manager); } }); }
public static void registerRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityQueen.class, new IRenderFactory<EntityQueen>() { @Override public Render<EntityQueen> createRenderFor(RenderManager manager) { return new RenderQueen(manager); } }); }
@SuppressWarnings("unchecked") private <T extends Entity> Render<T> getRenderer(Class<T> cl) { Render<T> render = (Render<T>) this.renderMap.get(cl); if (render == null) throw new MissingRendererException(cl); return render; }
@Override public Render<? super EntityCreeper> createRenderFor(RenderManager manager) { RenderChameleonCreeper r; try { r = new RenderChameleonCreeper(manager); } catch (IOException ie) { r = null; ie.printStackTrace(); } return r; }
public static void registerRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityRainbowKing.class, new IRenderFactory<EntityRainbowKing>() { @Override public Render<? super EntityRainbowKing> createRenderFor(RenderManager manager) { return new RenderRainbowKing(manager); } }); }