Ejemplo n.º 1
0
  private void renderItem(PedestalTileEntity te) {
    ItemStack stack = te.getStack();
    if (stack != null) {
      RenderHelper.enableStandardItemLighting();
      GlStateManager.enableLighting();
      GlStateManager.pushMatrix();
      // Translate to the center of the block and .9 points higher
      GlStateManager.translate(.5, .9, .5);
      GlStateManager.scale(.4f, .4f, .4f);

      Minecraft.getMinecraft()
          .getRenderItem()
          .renderItem(stack, ItemCameraTransforms.TransformType.NONE);

      GlStateManager.popMatrix();
    }
  }
Ejemplo n.º 2
0
  private void renderHandles(PedestalTileEntity te) {
    GlStateManager.pushMatrix();

    GlStateManager.translate(.5, 0, .5);
    long angle = (System.currentTimeMillis() / 10) % 360;
    GlStateManager.rotate(angle, 0, 1, 0);

    RenderHelper.disableStandardItemLighting();
    this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    if (Minecraft.isAmbientOcclusionEnabled()) {
      GlStateManager.shadeModel(GL11.GL_SMOOTH);
    } else {
      GlStateManager.shadeModel(GL11.GL_FLAT);
    }

    World world = te.getWorld();
    // Translate back to local view coordinates so that we can do the acual rendering here
    GlStateManager.translate(-te.getPos().getX(), -te.getPos().getY(), -te.getPos().getZ());

    Tessellator tessellator = Tessellator.getInstance();
    tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
    Minecraft.getMinecraft()
        .getBlockRendererDispatcher()
        .getBlockModelRenderer()
        .renderModel(
            world,
            getBakedModel(),
            world.getBlockState(te.getPos()),
            te.getPos(),
            Tessellator.getInstance().getBuffer(),
            false);
    tessellator.draw();

    RenderHelper.enableStandardItemLighting();
    GlStateManager.popMatrix();
  }