private void serverTick(boolean doEffects) {
    World entityWorld = MinecraftServer.getServer().getEntityWorld();
    RfToolsDimensionManager dimensionManager =
        RfToolsDimensionManager.getDimensionManager(entityWorld);

    if (!dimensionManager.getDimensions().isEmpty()) {
      DimensionStorage dimensionStorage = DimensionStorage.getDimensionStorage(entityWorld);

      for (Map.Entry<Integer, DimensionDescriptor> entry :
          dimensionManager.getDimensions().entrySet()) {
        Integer id = entry.getKey();
        // If there is an activity probe we only drain power if the dimension is loaded (a player is
        // there or a chunkloader)
        DimensionInformation information = dimensionManager.getDimensionInformation(id);
        WorldServer world = DimensionManager.getWorld(id);

        // Power handling.
        if (world != null || information.getProbeCounter() == 0) {
          handlePower(doEffects, dimensionStorage, entry, id, information);
        }

        // Special effect handling.
        if (world != null && !world.playerEntities.isEmpty()) {
          handleRandomEffects(world, information);
        }
      }

      dimensionStorage.save(entityWorld);
    }
  }
 private void handleRandomEffects(WorldServer world, DimensionInformation information) {
   // The world is loaded and there are players there.
   if (information.isPatreonBitSet(Patreons.PATREON_FIREWORKS)) {
     handleFireworks(world);
   }
   if (information.isPatreonBitSet(Patreons.PATREON_TOMWOLF)) {
     handleHowlingWolf(world, information);
   }
 }
Beispiel #3
0
 private static ResourceLocation getSun(DimensionInformation information) {
   ResourceLocation sun;
   if (information.isPatreonBitSet(Patreons.PATREON_SICKSUN)) {
     sun = locationSickSunPng;
   } else if (information.isPatreonBitSet(Patreons.PATREON_RABBITSUN)) {
     sun = locationRabbitSunPng;
   } else {
     sun = locationSunPng;
   }
   return sun;
 }
Beispiel #4
0
 private static ResourceLocation getMoon(DimensionInformation information) {
   ResourceLocation moon;
   if (information.isPatreonBitSet(Patreons.PATREON_SICKMOON)) {
     moon = locationSickMoonPng;
   } else if (information.isPatreonBitSet(Patreons.PATREON_RABBITMOON)) {
     moon = locationRabbitMoonPng;
   } else if (information.isPatreonBitSet(Patreons.PATREON_TOMWOLF)) {
     moon = locationWolfMoonPng;
   } else {
     moon = locationMoonPhasesPng;
   }
   return moon;
 }
Beispiel #5
0
 @Override
 public void inject(DimletKey key, DimensionInformation dimensionInformation) {
   SkyDescriptor.Builder builder = new SkyDescriptor.Builder();
   builder.combine(dimensionInformation.getSkyDescriptor());
   SkyDescriptor newDescriptor = DimletObjectMapping.idToSkyDescriptor.get(key);
   if (newDescriptor.specifiesFogColor()) {
     builder.resetFogColor();
   }
   if (newDescriptor.specifiesSkyColor()) {
     builder.resetSkyColor();
   }
   builder.combine(newDescriptor);
   dimensionInformation.setSkyDescriptor(builder.build());
 }
  private void handlePower(
      boolean doEffects,
      DimensionStorage dimensionStorage,
      Map.Entry<Integer, DimensionDescriptor> entry,
      Integer id,
      DimensionInformation information) {
    int cost = 0;
    if (DimletConfiguration.dimensionDifficulty != -1) {
      cost = information.getActualRfCost();
      if (cost == 0) {
        cost = entry.getValue().getRfMaintainCost();
      }
    }

    int power = dimensionStorage.getEnergyLevel(id);
    power -= cost * MAXTICKS;
    if (power < 0) {
      power = 0;
    }

    handleLowPower(id, power, doEffects);
    if (doEffects && power > 0) {
      handleEffectsForDimension(power, id, information);
    }

    dimensionStorage.setEnergyLevel(id, power);
  }
Beispiel #7
0
  @Override
  public void constructDimension(
      List<Pair<DimletKey, List<DimletKey>>> dimlets,
      Random random,
      DimensionInformation dimensionInformation) {
    dimlets = DimensionInformation.extractType(DimletType.DIMLET_SKY, dimlets);
    if (dimlets.isEmpty()) {
      if (random.nextFloat() < DimletConfiguration.randomSpecialSkyChance) {
        // If nothing was specified then there is random chance we get random sky stuff.
        List<DimletKey> skyIds =
            new ArrayList<DimletKey>(DimletObjectMapping.idToSkyDescriptor.keySet());
        for (int i = 0; i < 1 + random.nextInt(3); i++) {
          DimletKey key = skyIds.get(random.nextInt(skyIds.size()));
          List<DimletKey> modifiers = Collections.emptyList();
          dimlets.add(Pair.of(key, modifiers));
        }
      }

      if (random.nextFloat() < DimletConfiguration.randomSpecialSkyChance) {
        List<DimletKey> bodyKeys = new ArrayList<DimletKey>();
        for (DimletKey key : DimletObjectMapping.idToSkyDescriptor.keySet()) {
          if (DimletObjectMapping.celestialBodies.contains(key)) {
            bodyKeys.add(key);
          }
        }

        for (int i = 0; i < random.nextInt(3); i++) {
          DimletKey key = bodyKeys.get(random.nextInt(bodyKeys.size()));
          List<DimletKey> modifiers = Collections.emptyList();
          dimlets.add(Pair.of(key, modifiers));
        }
      }
    }

    SkyDescriptor.Builder builder = new SkyDescriptor.Builder();
    for (Pair<DimletKey, List<DimletKey>> dimletWithModifiers : dimlets) {
      DimletKey key = dimletWithModifiers.getKey();
      builder.combine(DimletObjectMapping.idToSkyDescriptor.get(key));
    }
    dimensionInformation.setSkyDescriptor(builder.build());
  }
  @Override
  public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
    if (!world.isRemote) {
      int id = player.worldObj.provider.dimensionId;
      RfToolsDimensionManager dimensionManager =
          RfToolsDimensionManager.getDimensionManager(player.worldObj);
      DimensionInformation dimensionInformation = dimensionManager.getDimensionInformation(id);
      if (dimensionInformation == null) {
        Logging.message(player, "Not an RFTools dimension!");
      } else {
        String name = dimensionInformation.getName();
        DimensionStorage storage = DimensionStorage.getDimensionStorage(player.getEntityWorld());
        int power = storage != null ? storage.getEnergyLevel(id) : 0;

        Logging.message(
            player,
            EnumChatFormatting.BLUE
                + "Name: "
                + name
                + " (Id "
                + id
                + ")"
                + EnumChatFormatting.YELLOW
                + "    Power: "
                + power
                + " RF");
        if (player.isSneaking()) {
          Logging.message(
              player,
              EnumChatFormatting.RED
                  + "Description: "
                  + dimensionInformation.getDescriptor().getDescriptionString());
          System.out.println(
              "Description:  = " + dimensionInformation.getDescriptor().getDescriptionString());
        }
      }
      return stack;
    }
    return stack;
  }
  @Override
  public void addInformation(
      ItemStack itemStack, EntityPlayer player, List list, boolean whatIsThis) {
    super.addInformation(itemStack, player, list, whatIsThis);
    int id = player.worldObj.provider.dimensionId;
    RfToolsDimensionManager dimensionManager =
        RfToolsDimensionManager.getDimensionManager(player.worldObj);
    DimensionInformation dimensionInformation = dimensionManager.getDimensionInformation(id);
    if (dimensionInformation == null) {
      list.add("Not an RFTools dimension!");
    } else {
      if (System.currentTimeMillis() - lastTime > 500) {
        lastTime = System.currentTimeMillis();
        PacketHandler.INSTANCE.sendToServer(new PacketGetDimensionEnergy(id));
      }
      String name = dimensionInformation.getName();
      DimensionStorage storage = DimensionStorage.getDimensionStorage(player.getEntityWorld());
      int power = storage != null ? storage.getEnergyLevel(id) : 0;

      list.add(EnumChatFormatting.BLUE + "Name: " + name + " (Id " + id + ")");

      list.add(EnumChatFormatting.YELLOW + "Power: " + power + " RF");
    }
  }
 private void handleEffectsForDimension(int power, int id, DimensionInformation information) {
   WorldServer world = DimensionManager.getWorld(id);
   if (world != null) {
     Set<EffectType> effects = information.getEffectTypes();
     List<EntityPlayer> players = new ArrayList<EntityPlayer>(world.playerEntities);
     for (EntityPlayer player : players) {
       for (EffectType effect : effects) {
         Integer potionEffect = effectsMap.get(effect);
         if (potionEffect != null) {
           Integer amplifier = effectAmplifierMap.get(effect);
           if (amplifier == null) {
             amplifier = 0;
           }
           player.addPotionEffect(
               new PotionEffect(potionEffect, EFFECTS_MAX * MAXTICKS * 3, amplifier, true));
         } else if (effect == EffectType.EFFECT_FLIGHT) {
           BuffProperties.addBuff(player, PlayerBuff.BUFF_FLIGHT, EFFECTS_MAX * MAXTICKS * 2);
         }
       }
       if (power < DimletConfiguration.DIMPOWER_WARN3) {
         // We are VERY low on power. Start bad effects.
         player.addPotionEffect(
             new PotionEffect(Potion.moveSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 4, true));
         player.addPotionEffect(
             new PotionEffect(Potion.digSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 4, true));
         player.addPotionEffect(
             new PotionEffect(Potion.poison.getId(), EFFECTS_MAX * MAXTICKS, 2, true));
         player.addPotionEffect(
             new PotionEffect(Potion.hunger.getId(), EFFECTS_MAX * MAXTICKS, 2, true));
       } else if (power < DimletConfiguration.DIMPOWER_WARN2) {
         player.addPotionEffect(
             new PotionEffect(Potion.moveSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 2, true));
         player.addPotionEffect(
             new PotionEffect(Potion.digSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 2, true));
         player.addPotionEffect(
             new PotionEffect(Potion.hunger.getId(), EFFECTS_MAX * MAXTICKS, 1, true));
       } else if (power < DimletConfiguration.DIMPOWER_WARN1) {
         player.addPotionEffect(
             new PotionEffect(Potion.moveSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 0, true));
         player.addPotionEffect(
             new PotionEffect(Potion.digSlowdown.getId(), EFFECTS_MAX * MAXTICKS, 0, true));
       }
     }
   }
 }
 private void handleHowlingWolf(WorldServer world, DimensionInformation information) {
   if (information.getCelestialAngle() == null) {
     // We don't have fixed time.
     float a = world.getCelestialAngle(1.0f);
     t--;
     if (t <= 0) {
       t = 0;
     }
     if (Math.abs(a - 0.5f) < 0.05f) {
       if (t <= 0) {
         playHowl(world);
         t = 40;
       }
     }
   } else {
     // We have fixed time so just play the sound at random moments
     if (random.nextFloat() < 0.001) {
       playHowl(world);
     }
   }
 }
Beispiel #12
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);
  }
Beispiel #13
0
  private static void renderCelestialBodies(
      float partialTickTime,
      DimensionInformation information,
      WorldClient world,
      TextureManager renderEngine,
      Tessellator tessellator) {
    List<CelestialBodyDescriptor> celestialBodies = information.getCelestialBodyDescriptors();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.glBlendFunc(770, 1, 1, 0);
    GL11.glPushMatrix();

    float f6 = 1.0F - world.getRainStrength(partialTickTime);
    ResourceLocation sun = getSun(information);
    ResourceLocation moon = getMoon(information);

    if (celestialBodies.isEmpty()) {
      GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
      GL11.glTranslatef(0.0F, 0.0F, 0.0F);
      GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(world.getCelestialAngle(partialTickTime) * 360.0F, 1.0F, 0.0F, 0.0F);
      float f10 = 30.0F;
      renderEngine.bindTexture(sun);
      tessellator.startDrawingQuads();
      tessellator.addVertexWithUV((-f10), 100.0D, (-f10), 0.0D, 0.0D);
      tessellator.addVertexWithUV(f10, 100.0D, (-f10), 1.0D, 0.0D);
      tessellator.addVertexWithUV(f10, 100.0D, f10, 1.0D, 1.0D);
      tessellator.addVertexWithUV((-f10), 100.0D, f10, 0.0D, 1.0D);
      tessellator.draw();
      f10 = 20.0F;
      float f14, f15, f16, f17;
      renderEngine.bindTexture(moon);
      if (!moon.equals(locationMoonPhasesPng)) {
        f14 = 0.0f;
        f15 = 0.0f;
        f16 = 1.0f;
        f17 = 1.0f;
      } else {
        int k = world.getMoonPhase();
        int l = k % 4;
        int i1 = k / 4 % 2;
        f14 = (l + 0) / 4.0F;
        f15 = (i1 + 0) / 2.0F;
        f16 = (l + 1) / 4.0F;
        f17 = (i1 + 1) / 2.0F;
      }
      tessellator.startDrawingQuads();
      tessellator.addVertexWithUV((-f10), -100.0D, f10, f16, f17);
      tessellator.addVertexWithUV(f10, -100.0D, f10, f14, f17);
      tessellator.addVertexWithUV(f10, -100.0D, (-f10), f14, f15);
      tessellator.addVertexWithUV((-f10), -100.0D, (-f10), f16, f15);
      tessellator.draw();
    } else {
      Random random = new Random(world.getSeed());
      for (CelestialBodyDescriptor body : celestialBodies) {
        float offset = 0.0f;
        float factor = 1.0f;
        float yangle = -90.0f;
        if (!body.isMain()) {
          offset = random.nextFloat() * 200.0f;
          factor = random.nextFloat() * 3.0f;
          yangle = random.nextFloat() * 180.0f;
        }
        switch (body.getType()) {
          case BODY_NONE:
            break;
          case BODY_SUN:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderSun(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                30.0F,
                sun);
            break;
          case BODY_LARGESUN:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderSun(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                80.0F,
                sun);
            break;
          case BODY_SMALLSUN:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderSun(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                10.0F,
                sun);
            break;
          case BODY_REDSUN:
            GL11.glColor4f(1.0F, 0.0F, 0.0F, f6);
            renderSun(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                30.0F,
                sun);
            break;
          case BODY_MOON:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderMoon(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                20.0F,
                moon);
            break;
          case BODY_LARGEMOON:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderMoon(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                60.0F,
                moon);
            break;
          case BODY_SMALLMOON:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderMoon(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                10.0F,
                moon);
            break;
          case BODY_REDMOON:
            GL11.glColor4f(1.0F, 0.0F, 0.0F, f6);
            renderMoon(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                20.0F,
                moon);
            break;
          case BODY_PLANET:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderPlanet(
                partialTickTime, world, renderEngine, tessellator, offset, factor, yangle, 10.0F);
            break;
          case BODY_LARGEPLANET:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderPlanet(
                partialTickTime, world, renderEngine, tessellator, offset, factor, yangle, 30.0F);
            break;
        }
      }
    }

    GL11.glDisable(GL11.GL_TEXTURE_2D);

    float f18 = world.getStarBrightness(partialTickTime) * f6;

    if (f18 > 0.0F) {
      GL11.glColor4f(f18, f18, f18, f18);
      GL11.glCallList(starGLCallList);
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
  }