예제 #1
0
  private DisplayInteger[] getListAndRender(RenderData data, Fluid fluid, World world) {
    if (cachedCenterFluids.containsKey(data) && cachedCenterFluids.get(data).containsKey(fluid)) {
      return cachedCenterFluids.get(data).get(fluid);
    }

    Model3D toReturn = new Model3D();
    toReturn.baseBlock = Blocks.water;
    toReturn.setTexture(fluid.getIcon());

    final int stages = getStages(data.height);
    DisplayInteger[] displays = new DisplayInteger[stages];

    if (cachedCenterFluids.containsKey(data)) {
      cachedCenterFluids.get(data).put(fluid, displays);
    } else {
      HashMap<Fluid, DisplayInteger[]> map = new HashMap<Fluid, DisplayInteger[]>();
      map.put(fluid, displays);
      cachedCenterFluids.put(data, map);
    }

    for (int i = 0; i < stages; i++) {
      displays[i] = DisplayInteger.createAndStart();

      if (fluid.getIcon() != null) {
        toReturn.minX = 0 + .01;
        toReturn.minY = 0 + .01;
        toReturn.minZ = 0 + .01;

        toReturn.maxX = data.length - .01;
        toReturn.maxY = ((float) i / (float) stages) * (data.height - 2) - .01;
        toReturn.maxZ = data.width - .01;

        MekanismRenderer.renderObject(toReturn);
      }

      GL11.glEndList();
    }

    return displays;
  }
예제 #2
0
  private DisplayInteger getValveDisplay(ValveRenderData data, Fluid fluid, World world) {
    if (cachedValveFluids.containsKey(data) && cachedValveFluids.get(data).containsKey(fluid)) {
      return cachedValveFluids.get(data).get(fluid);
    }

    Model3D toReturn = new Model3D();
    toReturn.baseBlock = Blocks.water;
    toReturn.setTexture(fluid.getFlowingIcon());

    DisplayInteger display = DisplayInteger.createAndStart();

    if (cachedValveFluids.containsKey(data)) {
      cachedValveFluids.get(data).put(fluid, display);
    } else {
      HashMap<Fluid, DisplayInteger> map = new HashMap<Fluid, DisplayInteger>();
      map.put(fluid, display);
      cachedValveFluids.put(data, map);
    }

    switch (data.side) {
      case DOWN:
        {
          toReturn.minX = .3;
          toReturn.minY = 1 + .01;
          toReturn.minZ = .3;

          toReturn.maxX = .7;
          toReturn.maxY = 1.4 + .1;
          toReturn.maxZ = .7;
          break;
        }
      case UP:
        {
          toReturn.minX = .3;
          toReturn.minY = -(data.height - 2) - .01;
          toReturn.minZ = .3;

          toReturn.maxX = .7;
          toReturn.maxY = -.01;
          toReturn.maxZ = .7;
          break;
        }
      case NORTH:
        {
          toReturn.minX = .3;
          toReturn.minY = -(getValveFluidHeight(data)) + .01;
          toReturn.minZ = 1 + .02;

          toReturn.maxX = .7;
          toReturn.maxY = .7;
          toReturn.maxZ = 1.4;
          break;
        }
      case SOUTH:
        {
          toReturn.minX = .3;
          toReturn.minY = -(getValveFluidHeight(data)) + .01;
          toReturn.minZ = -.4;

          toReturn.maxX = .7;
          toReturn.maxY = .7;
          toReturn.maxZ = -.02;
          break;
        }
      case WEST:
        {
          toReturn.minX = 1 + .02;
          toReturn.minY = -(getValveFluidHeight(data)) + .01;
          toReturn.minZ = .3;

          toReturn.maxX = 1.4;
          toReturn.maxY = .7;
          toReturn.maxZ = .7;
          break;
        }
      case EAST:
        {
          toReturn.minX = -.4;
          toReturn.minY = -(getValveFluidHeight(data)) + .01;
          toReturn.minZ = .3;

          toReturn.maxX = -.02;
          toReturn.maxY = .7;
          toReturn.maxZ = .7;
          break;
        }
      default:
        {
          break;
        }
    }

    if (fluid.getFlowingIcon() != null) {
      MekanismRenderer.renderObject(toReturn);
    }

    display.endList();

    return display;
  }
  @SuppressWarnings("incomplete-switch")
  private DisplayInteger[] getListAndRender(SalinationRenderData data, Fluid fluid) {
    if (cachedCenterFluids.containsKey(data) && cachedCenterFluids.get(data).containsKey(fluid)) {
      return cachedCenterFluids.get(data).get(fluid);
    }

    Model3D toReturn = new Model3D();
    toReturn.baseBlock = Block.waterStill;
    toReturn.setTexture(fluid.getIcon());

    final int stages = getStages(data.height);
    DisplayInteger[] displays = new DisplayInteger[stages];

    if (cachedCenterFluids.containsKey(data)) {
      cachedCenterFluids.get(data).put(fluid, displays);
    } else {
      HashMap<Fluid, DisplayInteger[]> map = new HashMap<Fluid, DisplayInteger[]>();
      map.put(fluid, displays);
      cachedCenterFluids.put(data, map);
    }

    MekanismRenderer.colorFluid(fluid);

    for (int i = 0; i < stages; i++) {
      displays[i] = DisplayInteger.createAndStart();

      if (fluid.getIcon() != null) {
        switch (data.side) {
          case NORTH:
            toReturn.minX = 0 + .01;
            toReturn.minY = 0 + .01;
            toReturn.minZ = 0 + .01;

            toReturn.maxX = 2 - .01;
            toReturn.maxY = ((float) i / (float) stages) * data.height - .01;
            toReturn.maxZ = 2 - .01;
            break;
          case SOUTH:
            toReturn.minX = -1 + .01;
            toReturn.minY = 0 + .01;
            toReturn.minZ = -1 + .01;

            toReturn.maxX = 1 - .01;
            toReturn.maxY = ((float) i / (float) stages) * data.height - .01;
            toReturn.maxZ = 1 - .01;
            break;
          case WEST:
            toReturn.minX = 0 + .01;
            toReturn.minY = 0 + .01;
            toReturn.minZ = -1 + .01;

            toReturn.maxX = 2 - .01;
            toReturn.maxY = ((float) i / (float) stages) * data.height - .01;
            toReturn.maxZ = 1 - .01;
            break;
          case EAST:
            toReturn.minX = -1 + .01;
            toReturn.minY = 0 + .01;
            toReturn.minZ = 0 + .01;

            toReturn.maxX = 1 - .01;
            toReturn.maxY = ((float) i / (float) stages) * data.height - .01;
            toReturn.maxZ = 2 - .01;
            break;
        }

        MekanismRenderer.renderObject(toReturn);
      }

      displays[i].endList();
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    return displays;
  }