Java Code Examples for net.minecraft.client.renderer.BufferBuilder#getDrawMode()

The following examples show how to use net.minecraft.client.renderer.BufferBuilder#getDrawMode() . 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: GeometryTessellator.java    From LunatriusCore with MIT License 6 votes vote down vote up
private static void drawCuboid(final BufferBuilder buffer, final BlockPos begin, final BlockPos end, final int sides, final int argb, final double delta) {
    if (buffer.getDrawMode() == -1 || sides == 0) {
        return;
    }

    final double x0 = begin.getX() - delta;
    final double y0 = begin.getY() - delta;
    final double z0 = begin.getZ() - delta;
    final double x1 = end.getX() + 1 + delta;
    final double y1 = end.getY() + 1 + delta;
    final double z1 = end.getZ() + 1 + delta;

    switch (buffer.getDrawMode()) {
    case GL11.GL_QUADS:
        drawQuads(buffer, x0, y0, z0, x1, y1, z1, sides, argb);
        break;

    case GL11.GL_LINES:
        drawLines(buffer, x0, y0, z0, x1, y1, z1, sides, argb);
        break;

    default:
        throw new IllegalStateException("Unsupported mode!");
    }
}
 
Example 2
Source File: GeometryTessellator.java    From ForgeHax with MIT License 5 votes vote down vote up
private static void drawCuboid(
    final BufferBuilder buffer,
    final BlockPos begin,
    final BlockPos end,
    final int sides,
    final int argb,
    final double delta) {
  if (buffer.getDrawMode() == -1 || sides == 0) {
    return;
  }
  
  final double x0 = begin.getX() - delta;
  final double y0 = begin.getY() - delta;
  final double z0 = begin.getZ() - delta;
  final double x1 = end.getX() + 1 + delta;
  final double y1 = end.getY() + 1 + delta;
  final double z1 = end.getZ() + 1 + delta;
  
  switch (buffer.getDrawMode()) {
    case GL11.GL_QUADS:
      drawQuads(buffer, x0, y0, z0, x1, y1, z1, sides, argb);
      break;
    
    case GL11.GL_LINES:
      drawLines(buffer, x0, y0, z0, x1, y1, z1, sides, argb);
      break;
    
    default:
      throw new IllegalStateException("Unsupported mode!");
  }
}