コード例 #1
0
ファイル: PacketSky.java プロジェクト: martynd/Spoutcraft
 public PacketSky(int cloudY, int stars, int sunPercent, int moonPercent, Color skyColor) {
   this.cloudY = cloudY;
   this.stars = stars;
   this.sunPercent = sunPercent;
   this.moonPercent = moonPercent;
   this.skyColor = skyColor.clone();
 }
コード例 #2
0
ファイル: PacketSky.java プロジェクト: martynd/Spoutcraft
  @Override
  public void run(int PlayerId) {
    if (cloudY != 0) {
      SpoutClient.getInstance().getSkyManager().setCloudHeight(cloudY);
    }
    if (stars != 0) {
      SpoutClient.getInstance().getSkyManager().setStarFrequency(stars);
    }
    if (sunPercent != 0) {
      SpoutClient.getInstance().getSkyManager().setSunSizePercent(sunPercent);
    }
    if (moonPercent != 0) {
      SpoutClient.getInstance().getSkyManager().setMoonSizePercent(moonPercent);
    }
    if (sun != null) {
      if (sun.equals("[reset]")) {
        SpoutClient.getInstance().getSkyManager().setSunTextureUrl(null);
      } else if (sun.length() > 5) {
        SpoutClient.getInstance().getSkyManager().setSunTextureUrl(sun);
      }
    }
    if (moon != null) {
      if (moon.equals("[reset]")) {
        SpoutClient.getInstance().getSkyManager().setMoonTextureUrl(null);
      } else if (moon.length() > 5) {
        SpoutClient.getInstance().getSkyManager().setMoonTextureUrl(moon);
      }
    }
    SkyManager sky = SpoutClient.getInstance().getSkyManager();

    // Sky
    if (skyColor.isOverride()) {
      sky.setSkyColor(null);
    } else if (!skyColor.isInvalid()) {
      sky.setSkyColor(skyColor);
    }

    // Fog
    if (fogColor.isOverride()) {
      sky.setFogColor(null);
    } else if (!fogColor.isInvalid()) {
      sky.setFogColor(fogColor);
    }

    // Cloud
    if (cloudColor.isOverride()) {
      sky.setCloudColor(null);
    } else if (!cloudColor.isInvalid()) {
      sky.setCloudColor(cloudColor);
    }
  }