Java Code Examples for net.minecraft.client.renderer.block.model.IBakedModel#isBuiltInRenderer()
The following examples show how to use
net.minecraft.client.renderer.block.model.IBakedModel#isBuiltInRenderer() .
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: TilePitKiln.java From TFC2 with GNU General Public License v3.0 | 6 votes |
@SideOnly(Side.CLIENT) public static PropertyItem.PItem getDisplayItem(ItemStack stack, World world, EntityLivingBase entity, float x, float z) { if(stack == null) return null; IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, world, entity); if(model == null || model.isBuiltInRenderer()) { // missing model so people don't go paranoid when their chests go missing model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getMissingModel(); } PropertyItem.PItem item = new PropertyItem.PItem(model, x,0,z, 0.5f, (float) (Math.PI/2)); if(stack.getItem() instanceof ItemBlock) { item.y = -0.3125f; item.s = 0.375f; item.r = 0; } return item; }
Example 2
Source File: TileSmallVessel.java From TFC2 with GNU General Public License v3.0 | 6 votes |
@SideOnly(Side.CLIENT) public static PropertyItem.PItem getDisplayItem(ItemStack stack, World world, EntityLivingBase entity, float x, float z, EnumFacing.Axis axis) { if(stack == null) return null; IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, world, entity); if(model == null || model.isBuiltInRenderer()) { // missing model so people don't go paranoid when their chests go missing model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getMissingModel(); } float rotation = 0; if(axis == EnumFacing.Axis.X) { rotation = (float)Math.PI /2f; } PropertyItem.PItem item = new PropertyItem.PItem(model, x,0,z, 0.45f, axis == EnumFacing.Axis.X ? (float) (Math.PI/2f) : 0); if(stack.getItem() instanceof ItemBlock) { item.y = -0.3125f; item.s = 0.375f; item.r = 0; } return item; }
Example 3
Source File: TileAnvil.java From TFC2 with GNU General Public License v3.0 | 6 votes |
@SideOnly(Side.CLIENT) public static PropertyItem.PItem getAnvilItem(ItemStack stack, World world, EntityLivingBase entity, float x, float z) { if(stack == null) return null; IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, world, entity); if(model == null || model.isBuiltInRenderer()) { // missing model so people don't go paranoid when their chests go missing model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getMissingModel(); } PropertyItem.PItem item = new PropertyItem.PItem(model, x,0,z, 0.5f, (float) (Math.PI/2)); if(stack.getItem() instanceof ItemBlock) { item.y = -0.3125f; item.s = 0.375f; item.r = 0; } return item; }
Example 4
Source File: RenderUtils.java From Wizardry with GNU Lesser General Public License v3.0 | 4 votes |
/** * Will render an itemstack with opacity support properly. Minecraft does not normally support this so we * reimplemented all the itemstack rendering code. */ public static void renderItemStackWithOpacity(ItemStack stack, float opacity, @Nullable Runnable preDrawRunnable) { RenderHelper.enableGUIStandardItemLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.enableTexture2D(); GlStateManager.scale(2, 2, 2); if (preDrawRunnable != null) preDrawRunnable.run(); GlStateManager.color(1f, 1f, 1f, opacity); IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, null, Minecraft.getMinecraft().player); GlStateManager.pushMatrix(); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); GlStateManager.enableRescaleNormal(); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.translate(8.0F, 8.0F, 0.0F); GlStateManager.scale(1.0F, -1.0F, 1.0F); GlStateManager.scale(16.0F, 16.0F, 16.0F); if (model.isGui3d()) GlStateManager.enableLighting(); else GlStateManager.disableLighting(); ForgeHooksClient.handleCameraTransforms(model, ItemCameraTransforms.TransformType.GUI, false); if (!stack.isEmpty()) { GlStateManager.pushMatrix(); GlStateManager.translate(-0.5F, -0.5F, -0.5F); if (model.isBuiltInRenderer()) { GlStateManager.enableRescaleNormal(); stack.getItem().getTileEntityItemStackRenderer().renderByItem(stack); } else { renderModel(model, 0xFFFFFF | (((int) (opacity * 255)) << 24), stack); if (stack.hasEffect()) { renderEffect(model); } } GlStateManager.translate(0.5F, 0.5F, 0.5F); GlStateManager.popMatrix(); } GlStateManager.translate(-8.0F, -8.0F, -0.0F); GlStateManager.scale(1 / 16.0F, 1 / 16.0F, 1 / 16.0F); GlStateManager.scale(1 / 2.0, 1 / 2.0, 1 / 2.0); GlStateManager.disableAlpha(); GlStateManager.disableRescaleNormal(); GlStateManager.disableLighting(); GlStateManager.popMatrix(); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); GlStateManager.disableRescaleNormal(); RenderHelper.disableStandardItemLighting(); }