public RenderItem(TextureManager textureManager, ModelManager modelManager) { this.textureManager = textureManager; Config.setModelManager(modelManager); if (Reflector.ItemModelMesherForge_Constructor.exists()) { this.itemModelMesher = (ItemModelMesher)Reflector.newInstance(Reflector.ItemModelMesherForge_Constructor, new Object[] {modelManager}); } else { this.itemModelMesher = new ItemModelMesher(modelManager); } this.registerItems(); }
/** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doe */ public void doRender(EntityItemFrame entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.pushMatrix(); BlockPos blockpos = entity.getHangingPosition(); double d0 = (double)blockpos.getX() - entity.posX + x; double d1 = (double)blockpos.getY() - entity.posY + y; double d2 = (double)blockpos.getZ() - entity.posZ + z; GlStateManager.translate(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D); GlStateManager.rotate(180.0F - entity.rotationYaw, 0.0F, 1.0F, 0.0F); this.renderManager.renderEngine.bindTexture(TextureMap.locationBlocksTexture); BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher(); ModelManager modelmanager = blockrendererdispatcher.getBlockModelShapes().getModelManager(); IBakedModel ibakedmodel; if (entity.getDisplayedItem() != null && entity.getDisplayedItem().getItem() == Items.filled_map) { ibakedmodel = modelmanager.getModel(this.mapModel); } else { ibakedmodel = modelmanager.getModel(this.itemFrameModel); } GlStateManager.pushMatrix(); GlStateManager.translate(-0.5F, -0.5F, -0.5F); blockrendererdispatcher.getBlockModelRenderer().renderModelBrightnessColor(ibakedmodel, 1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); GlStateManager.translate(0.0F, 0.0F, 0.4375F); this.renderItem(entity); GlStateManager.popMatrix(); this.renderName(entity, x + (double)((float)entity.facingDirection.getFrontOffsetX() * 0.3F), y - 0.25D, z + (double)((float)entity.facingDirection.getFrontOffsetZ() * 0.3F)); }
public RenderItem(TextureManager textureManager, ModelManager modelManager) { this.textureManager = textureManager; this.itemModelMesher = new ItemModelMesher(modelManager); this.registerItems(); }
public ItemModelMesher(ModelManager modelManager) { this.modelManager = modelManager; }
public ModelManager getModelManager() { return this.modelManager; }
public BlockModelShapes(ModelManager manager) { this.modelManager = manager; this.registerAllBlocks(); }
public static void setModelManager(ModelManager p_setModelManager_0_) { modelManager = p_setModelManager_0_; }
public static ModelManager getModelManager() { return modelManager; }
static IBakedModel getModelCull(String p_getModelCull_0_, List p_getModelCull_1_) { ModelManager modelmanager = Config.getModelManager(); if (modelmanager == null) { return null; } else { ResourceLocation resourcelocation = new ResourceLocation("blockstates/" + p_getModelCull_0_ + "_leaves.json"); if (Config.getDefiningResourcePack(resourcelocation) != Config.getDefaultResourcePack()) { return null; } else { ResourceLocation resourcelocation1 = new ResourceLocation("models/block/" + p_getModelCull_0_ + "_leaves.json"); if (Config.getDefiningResourcePack(resourcelocation1) != Config.getDefaultResourcePack()) { return null; } else { ModelResourceLocation modelresourcelocation = new ModelResourceLocation(p_getModelCull_0_ + "_leaves", "normal"); IBakedModel ibakedmodel = modelmanager.getModel(modelresourcelocation); if (ibakedmodel != null && ibakedmodel != modelmanager.getMissingModel()) { List list = ibakedmodel.getGeneralQuads(); if (list.size() == 0) { return ibakedmodel; } else if (list.size() != 6) { return null; } else { for (Object bakedquad : list) { List list1 = ibakedmodel.getFaceQuads(((BakedQuad) bakedquad).getFace()); if (list1.size() > 0) { return null; } list1.add(bakedquad); } list.clear(); p_getModelCull_1_.add(p_getModelCull_0_ + "_leaves"); return ibakedmodel; } } else { return null; } } } } }
public EZItemRenderer(TextureManager textureManager, ModelManager modelManager) { super(textureManager, modelManager); }
@EventHandler public void init(FMLInitializationEvent event) { if (exempleEnabled) { logger.info("Registering ISBRH Block Exemple..."); testId = RenderRegistry.getNextAvailableRenderId(); GameRegistry.registerBlock(test, "test"); RenderRegistry.registerBlockHandler(new RenderExample()); RenderRegistry.registerTextureHandler((ITextureHandler) test); } Minecraft mc = Minecraft.getMinecraft(); // Prerequisite ModelManager modelManager = ObfuscationReflectionHelper .getPrivateValue(Minecraft.class, mc, "aL", "field_175617_aL", "modelManager"); RenderManager renderManager = mc.getRenderManager(); IReloadableResourceManager resourceManager = ((IReloadableResourceManager) mc .getResourceManager()); // Render Item Hook RenderItem item = new RenderItemISBRH(mc.getTextureManager(), modelManager, mc.getRenderItem()); ObfuscationReflectionHelper.setPrivateValue(Minecraft.class, mc, item, "X", "field_175621_X", "renderItem"); ObfuscationReflectionHelper.setPrivateValue(Minecraft.class, mc, new ItemRenderer(mc), "Y", "field_175620_Y", "itemRenderer"); renderManager.entityRenderMap.remove(EntityItem.class); renderManager.entityRenderMap.put(EntityItem.class, new RenderEntityItem(renderManager, item)); renderManager.entityRenderMap.remove(EntityItemFrame.class); renderManager.entityRenderMap.put(EntityItemFrame.class, new RenderItemFrame(renderManager, item)); mc.entityRenderer = new EntityRenderer(mc, resourceManager); // Render Block Dispatcher Hook BlockRendererDispatcher rendererDispatcher = new ISBRHDispatcher( mc.getBlockRendererDispatcher(), modelManager.getBlockModelShapes(), mc.gameSettings); ObfuscationReflectionHelper.setPrivateValue(Minecraft.class, mc, rendererDispatcher, "aM", "field_175618_aM", "blockRenderDispatcher"); // Register Reload Listeners resourceManager.registerReloadListener(rendererDispatcher); resourceManager.registerReloadListener(item); resourceManager.registerReloadListener(mc.entityRenderer); }