public RenderItem(TextureManager p_i46552_1_, ModelManager p_i46552_2_, ItemColors p_i46552_3_) { this.textureManager = p_i46552_1_; this.modelManager = p_i46552_2_; if (Reflector.ItemModelMesherForge_Constructor.exists()) { this.itemModelMesher = (ItemModelMesher)Reflector.newInstance(Reflector.ItemModelMesherForge_Constructor, new Object[] {p_i46552_2_}); } else { this.itemModelMesher = new ItemModelMesher(p_i46552_2_); } this.registerItems(); this.itemColors = p_i46552_3_; }
private void renderModel(EntityArtifactFrame entity) { BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher(); ModelManager modelmanager = blockrendererdispatcher.getBlockModelShapes().getModelManager(); IBakedModel ibakedmodel; if (!entity.getDisplayedItem().isEmpty() && entity.getDisplayedItem().getItem() == Items.FILLED_MAP) { //ModelResourceLocation mapModel = new ModelResourceLocation(new ResourceLocation("betterwithaddons",this.mapModel.getResourcePath()),this.mapModel.getVariant()); ibakedmodel = modelmanager.getModel(mapModel); } else { //ModelResourceLocation itemFrameModel = new ModelResourceLocation(new ResourceLocation("betterwithaddons",this.itemFrameModel.getResourcePath()),this.itemFrameModel.getVariant()); ibakedmodel = modelmanager.getModel(itemFrameModel); } //GlStateManager.pushMatrix(); //GlStateManager.translate(-0.5F, -0.5F, -0.5F); blockrendererdispatcher.getBlockModelRenderer().renderModelBrightnessColor(ibakedmodel, 1.0F, 1.0F, 1.0F, 1.0F); }
public void rebuildCache() { final ModelManager manager = this.getModelManager(); for (Map.Entry<Item, TIntObjectHashMap<ModelResourceLocation>> e : locations.entrySet()) { TIntObjectHashMap<IBakedModel> mods = models.get(e.getKey()); if (mods != null) { mods.clear(); } else { mods = new TIntObjectHashMap<IBakedModel>(); models.put(e.getKey(), mods); } final TIntObjectHashMap<IBakedModel> map = mods; e.getValue().forEachEntry(new TIntObjectProcedure<ModelResourceLocation>() { @Override public boolean execute(int meta, ModelResourceLocation location) { map.put(meta, manager.getModel(location)); return true; } }); } }
public RenderItem(TextureManager p_i46552_1_, ModelManager p_i46552_2_, ItemColors p_i46552_3_) { this.textureManager = p_i46552_1_; this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(p_i46552_2_); this.registerItems(); this.itemColors = p_i46552_3_; }
@Override @SideOnly(Side.CLIENT) public Pair<IBakedModel, Matrix4f> getModel(ITurtleAccess turtle, TurtleSide side) { final Minecraft mc = Minecraft.getMinecraft(); final ModelManager modelManager = mc.getRenderItem().getItemModelMesher().getModelManager(); // TODO: actual models ModelResourceLocation location = new ModelResourceLocation(side == TurtleSide.Left? "computercraft:turtle_crafting_table_left" : "computercraft:turtle_crafting_table_right", "inventory"); return Pair.of(modelManager.getModel(location), null); }
public DankNullRenderItem(TextureManager textureManager, ModelManager modelManager, ItemColors colors, @Nonnull ItemStack dankNull, boolean useLg, ContainerDankNull container) { super(textureManager, modelManager, colors); this.useLg = useLg; this.dankNull = dankNull; this.container = container; }
public ItemModelMesher(ModelManager modelManager) { this.modelManager = modelManager; }
public ModelManager getModelManager() { return this.modelManager; }
public BlockModelShapes(ModelManager manager) { this.modelManager = manager; this.registerAllBlocks(); }
/** * Renders the desired {@code T} type Entity. */ 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.LOCATION_BLOCKS_TEXTURE); BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher(); ModelManager modelmanager = blockrendererdispatcher.getBlockModelShapes().getModelManager(); IBakedModel ibakedmodel; if (!entity.getDisplayedItem().func_190926_b() && 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); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } blockrendererdispatcher.getBlockModelRenderer().renderModelBrightnessColor(ibakedmodel, 1.0F, 1.0F, 1.0F, 1.0F); if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } 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 static IBakedModel makeModel(String p_makeModel_0_, TextureAtlasSprite p_makeModel_1_, TextureAtlasSprite p_makeModel_2_) { if (p_makeModel_1_ != null && p_makeModel_2_ != null) { ModelManager modelmanager = Config.getModelManager(); if (modelmanager == null) { return null; } else { ModelResourceLocation modelresourcelocation = new ModelResourceLocation(p_makeModel_0_, "normal"); IBakedModel ibakedmodel = modelmanager.getModel(modelresourcelocation); if (ibakedmodel != null && ibakedmodel != modelmanager.getMissingModel()) { IBakedModel ibakedmodel1 = ModelUtils.duplicateModel(ibakedmodel); EnumFacing[] aenumfacing = EnumFacing.VALUES; for (int i = 0; i < aenumfacing.length; ++i) { EnumFacing enumfacing = aenumfacing[i]; List<BakedQuad> list = ibakedmodel1.getQuads((IBlockState)null, enumfacing, 0L); replaceTexture(list, p_makeModel_1_, p_makeModel_2_); } List<BakedQuad> list1 = ibakedmodel1.getQuads((IBlockState)null, (EnumFacing)null, 0L); replaceTexture(list1, p_makeModel_1_, p_makeModel_2_); return ibakedmodel1; } else { return null; } } } else { return null; } }
public static ModelManager getModelManager() { return minecraft.getRenderItem().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.getQuads((IBlockState)null, (EnumFacing)null, 0L); if (list.size() == 0) { return ibakedmodel; } else if (list.size() != 6) { return null; } else { for (Object bakedquad : list) { List list1 = ibakedmodel.getQuads((IBlockState)null, ((BakedQuad) bakedquad).getFace(), 0L); 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 static void onModelBake(ModelManager modelManager, IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, ModelLoader modelLoader) { MinecraftForge.EVENT_BUS.post(new ModelBakeEvent(modelManager, modelRegistry, modelLoader)); modelLoader.onPostBakeEvent(modelRegistry); }
public ModelBakeEvent(ModelManager modelManager, IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, ModelLoader modelLoader) { this.modelManager = modelManager; this.modelRegistry = modelRegistry; this.modelLoader = modelLoader; }
public ModelManager getModelManager() { return modelManager; }
public ItemModelMesherForge(ModelManager manager) { super(manager); }
/** * Renders the desired {@code T} type Entity. */ 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.LOCATION_BLOCKS_TEXTURE); 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); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } blockrendererdispatcher.getBlockModelRenderer().renderModelBrightnessColor(ibakedmodel, 1.0F, 1.0F, 1.0F, 1.0F); if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } 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 EZItemRenderer(TextureManager textureManager, ModelManager modelManager) { super(textureManager, modelManager, null); }