Exemplo n.º 1
0
 public static void registerNoSky(GenericWorldProvider provider) {
   provider.setSkyRenderer(
       new IRenderHandler() {
         @Override
         public void render(float partialTicks, WorldClient world, Minecraft mc) {}
       });
   provider.setCloudRenderer(
       new IRenderHandler() {
         @Override
         public void render(float partialTicks, WorldClient world, Minecraft mc) {}
       });
 }
Exemplo n.º 2
0
 public static void registerSky(
     GenericWorldProvider provider, final DimensionInformation information) {
   provider.setSkyRenderer(
       new IRenderHandler() {
         @Override
         public void render(float partialTicks, WorldClient world, Minecraft mc) {
           SkyRenderer.renderSky(partialTicks, information);
         }
       });
 }
Exemplo n.º 3
0
 public static void registerCloudRenderer(
     final GenericWorldProvider provider, final DimensionInformation information) {
   provider.setCloudRenderer(
       new IRenderHandler() {
         @Override
         public void render(float partialTicks, WorldClient world, Minecraft mc) {
           renderClouds(provider, information, partialTicks);
         }
       });
 }
Exemplo n.º 4
0
 public static void registerSkybox(GenericWorldProvider provider, final SkyType skyType) {
   provider.setSkyRenderer(
       new IRenderHandler() {
         @Override
         public void render(float partialTicks, WorldClient world, Minecraft mc) {
           ResourceLocation sky;
           ResourceLocation sky2 = null;
           int type = SKYTYPE_DARKTOP;
           switch (skyType) {
             case SKY_INFERNO:
               sky = locationPlasmaSkyPng;
               type = SKYTYPE_DARKTOP;
               break;
             case SKY_STARS1:
               sky = locationStars1;
               sky2 = locationStars1a;
               type = SKYTYPE_ALTERNATING;
               break;
             case SKY_STARS2:
               sky = locationStars2;
               type = SKYTYPE_ALL;
               break;
             case SKY_STARS3:
               sky = locationStars3;
               sky2 = locationStars3a;
               type = SKYTYPE_ALLHORIZONTAL;
               break;
             default:
               return;
           }
           SkyRenderer.renderSkyTexture(sky, sky2, type);
         }
       });
   provider.setCloudRenderer(
       new IRenderHandler() {
         @Override
         public void render(float partialTicks, WorldClient world, Minecraft mc) {}
       });
 }
Exemplo n.º 5
0
  @SideOnly(Side.CLIENT)
  public static void renderClouds(
      GenericWorldProvider provider, DimensionInformation information, float partialTicks) {
    GL11.glDisable(GL11.GL_CULL_FACE);
    Minecraft mc = Minecraft.getMinecraft();
    TextureManager renderEngine = mc.getTextureManager();
    float f1 =
        (float)
            (mc.renderViewEntity.lastTickPosY
                + (mc.renderViewEntity.posY - mc.renderViewEntity.lastTickPosY) * partialTicks);
    Tessellator tessellator = Tessellator.instance;
    float f2 = 12.0F;
    float f3 = 4.0F;
    RenderGlobal renderGlobal = mc.renderGlobal;
    double d0 = (CloudRenderAccessHelper.getCloudTickCounter(renderGlobal) + partialTicks);

    double entityX =
        mc.renderViewEntity.prevPosX
            + (mc.renderViewEntity.posX - mc.renderViewEntity.prevPosX) * partialTicks;
    double entityZ =
        mc.renderViewEntity.prevPosZ
            + (mc.renderViewEntity.posZ - mc.renderViewEntity.prevPosZ) * partialTicks;

    double d1 = (entityX + d0 * 0.029999999329447746D) / f2;
    double d2 = entityZ / f2 + 0.33000001311302185D;
    float y = provider.getCloudHeight() - f1 + 0.33F;
    int i = MathHelper.floor_double(d1 / 2048.0D);
    int j = MathHelper.floor_double(d2 / 2048.0D);
    d1 -= (i * 2048);
    d2 -= (j * 2048);
    renderEngine.bindTexture(locationCloudsPng);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    Vec3 vec3 = provider.worldObj.getCloudColour(partialTicks);
    float red = (float) vec3.xCoord;
    float green = (float) vec3.yCoord;
    float blue = (float) vec3.zCoord;
    float f8;
    float f9;
    float f10;

    if (mc.gameSettings.anaglyph) {
      f8 = (red * 30.0F + green * 59.0F + blue * 11.0F) / 100.0F;
      f9 = (red * 30.0F + green * 70.0F) / 100.0F;
      f10 = (red * 30.0F + blue * 70.0F) / 100.0F;
      red = f8;
      green = f9;
      blue = f10;
    }

    f10 = 0.00390625F;
    f8 = MathHelper.floor_double(d1) * f10;
    f9 = MathHelper.floor_double(d2) * f10;
    float f11 = (float) (d1 - MathHelper.floor_double(d1));
    float f12 = (float) (d2 - MathHelper.floor_double(d2));
    byte b0 = 8;
    byte b1 = 4;
    float f13 = 9.765625E-4F;
    GL11.glScalef(f2, 1.0F, f2);

    float cr = information.getSkyDescriptor().getCloudColorFactorR();
    float cg = information.getSkyDescriptor().getCloudColorFactorG();
    float cb = information.getSkyDescriptor().getCloudColorFactorB();
    boolean randomColors = information.isPatreonBitSet(Patreons.PATREON_KENNEY);

    for (int k = 0; k < 2; ++k) {
      if (k == 0) {
        GL11.glColorMask(false, false, false, false);
      } else if (mc.gameSettings.anaglyph) {
        if (EntityRenderer.anaglyphField == 0) {
          GL11.glColorMask(false, true, true, true);
        } else {
          GL11.glColorMask(true, false, false, true);
        }
      } else {
        GL11.glColorMask(true, true, true, true);
      }

      for (int l = -b1 + 1; l <= b1; ++l) {
        for (int i1 = -b1 + 1; i1 <= b1; ++i1) {
          tessellator.startDrawingQuads();
          float u = (l * b0);
          float v = (i1 * b0);
          float x = u - f11;
          float z = v - f12;
          if (randomColors) {
            //                        cr = (float) ((u % 10.0f) / 10.0f);
            //                        cg = (float) (((u + v) % 10.0f) / 10.0f);
            //                        cb = (float) ((v % 10.0f) / 10.0f);
            cr = x % 1.0f;
            cg = (x + z) % 1.0f;
            cb = z % 1.0f;
          }

          if (y > -f3 - 1.0F) {
            tessellator.setColorRGBA_F(red * 0.7F * cr, green * 0.7F * cg, blue * 0.7F * cb, 0.8F);
            tessellator.setNormal(0.0F, -1.0F, 0.0F);
            tessellator.addVertexWithUV(
                (x + 0.0F), (y + 0.0F), (z + b0), ((u + 0.0F) * f10 + f8), ((v + b0) * f10 + f9));
            tessellator.addVertexWithUV(
                (x + b0), (y + 0.0F), (z + b0), ((u + b0) * f10 + f8), ((v + b0) * f10 + f9));
            tessellator.addVertexWithUV(
                (x + b0), (y + 0.0F), (z + 0.0F), ((u + b0) * f10 + f8), ((v + 0.0F) * f10 + f9));
            tessellator.addVertexWithUV(
                (x + 0.0F),
                (y + 0.0F),
                (z + 0.0F),
                ((u + 0.0F) * f10 + f8),
                ((v + 0.0F) * f10 + f9));
          }

          if (y <= f3 + 1.0F) {
            tessellator.setColorRGBA_F(red * cr, green * cg, blue * cb, 0.8F);
            tessellator.setNormal(0.0F, 1.0F, 0.0F);
            tessellator.addVertexWithUV(
                (x + 0.0F),
                (y + f3 - f13),
                (z + b0),
                ((u + 0.0F) * f10 + f8),
                ((v + b0) * f10 + f9));
            tessellator.addVertexWithUV(
                (x + b0), (y + f3 - f13), (z + b0), ((u + b0) * f10 + f8), ((v + b0) * f10 + f9));
            tessellator.addVertexWithUV(
                (x + b0),
                (y + f3 - f13),
                (z + 0.0F),
                ((u + b0) * f10 + f8),
                ((v + 0.0F) * f10 + f9));
            tessellator.addVertexWithUV(
                (x + 0.0F),
                (y + f3 - f13),
                (z + 0.0F),
                ((u + 0.0F) * f10 + f8),
                ((v + 0.0F) * f10 + f9));
          }

          tessellator.setColorRGBA_F(red * 0.9F * cr, green * 0.9F * cg, blue * 0.9F * cb, 0.8F);
          int j1;

          if (l > -1) {
            tessellator.setNormal(-1.0F, 0.0F, 0.0F);

            for (j1 = 0; j1 < b0; ++j1) {
              tessellator.addVertexWithUV(
                  (x + j1 + 0.0F),
                  (y + 0.0F),
                  (z + b0),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + b0) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + j1 + 0.0F),
                  (y + f3),
                  (z + b0),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + b0) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + j1 + 0.0F),
                  (y + f3),
                  (z + 0.0F),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + 0.0F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + j1 + 0.0F),
                  (y + 0.0F),
                  (z + 0.0F),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + 0.0F) * f10 + f9));
            }
          }

          if (l <= 1) {
            tessellator.setNormal(1.0F, 0.0F, 0.0F);

            for (j1 = 0; j1 < b0; ++j1) {
              tessellator.addVertexWithUV(
                  (x + j1 + 1.0F - f13),
                  (y + 0.0F),
                  (z + b0),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + b0) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + j1 + 1.0F - f13),
                  (y + f3),
                  (z + b0),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + b0) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + j1 + 1.0F - f13),
                  (y + f3),
                  (z + 0.0F),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + 0.0F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + j1 + 1.0F - f13),
                  (y + 0.0F),
                  (z + 0.0F),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + 0.0F) * f10 + f9));
            }
          }

          tessellator.setColorRGBA_F(red * 0.8F * cr, green * 0.8F * cg, blue * 0.8F * cb, 0.8F);

          if (i1 > -1) {
            tessellator.setNormal(0.0F, 0.0F, -1.0F);

            for (j1 = 0; j1 < b0; ++j1) {
              tessellator.addVertexWithUV(
                  (x + 0.0F),
                  (y + f3),
                  (z + j1 + 0.0F),
                  ((u + 0.0F) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + b0),
                  (y + f3),
                  (z + j1 + 0.0F),
                  ((u + b0) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + b0),
                  (y + 0.0F),
                  (z + j1 + 0.0F),
                  ((u + b0) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + 0.0F),
                  (y + 0.0F),
                  (z + j1 + 0.0F),
                  ((u + 0.0F) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
            }
          }

          if (i1 <= 1) {
            tessellator.setNormal(0.0F, 0.0F, 1.0F);

            for (j1 = 0; j1 < b0; ++j1) {
              tessellator.addVertexWithUV(
                  (x + 0.0F),
                  (y + f3),
                  (z + j1 + 1.0F - f13),
                  ((u + 0.0F) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + b0),
                  (y + f3),
                  (z + j1 + 1.0F - f13),
                  ((u + b0) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + b0),
                  (y + 0.0F),
                  (z + j1 + 1.0F - f13),
                  ((u + b0) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + 0.0F),
                  (y + 0.0F),
                  (z + j1 + 1.0F - f13),
                  ((u + 0.0F) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
            }
          }

          tessellator.draw();
        }
      }
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
  }