Esempio n. 1
0
 public WorldSettings(WorldInfo p_i1958_1_) {
   this(
       p_i1958_1_.func_76063_b(),
       p_i1958_1_.func_76077_q(),
       p_i1958_1_.func_76089_r(),
       p_i1958_1_.func_76093_s(),
       p_i1958_1_.func_76067_t());
 }
Esempio n. 2
0
  public void addServerStatsToSnooper(PlayerUsageSnooper par1PlayerUsageSnooper) {
    par1PlayerUsageSnooper.addData("whitelist_enabled", Boolean.valueOf(false));
    par1PlayerUsageSnooper.addData("whitelist_count", Integer.valueOf(0));
    par1PlayerUsageSnooper.addData(
        "players_current", Integer.valueOf(this.getCurrentPlayerCount()));
    par1PlayerUsageSnooper.addData("players_max", Integer.valueOf(this.getMaxPlayers()));
    par1PlayerUsageSnooper.addData(
        "players_seen", Integer.valueOf(this.serverConfigManager.getAvailablePlayerDat().length));
    par1PlayerUsageSnooper.addData("uses_auth", Boolean.valueOf(this.onlineMode));
    par1PlayerUsageSnooper.addData("gui_state", this.getGuiEnabled() ? "enabled" : "disabled");
    par1PlayerUsageSnooper.addData(
        "avg_tick_ms", Integer.valueOf((int) (MathHelper.average(this.tickTimeArray) * 1.0E-6D)));
    par1PlayerUsageSnooper.addData(
        "avg_sent_packet_count",
        Integer.valueOf((int) MathHelper.average(this.sentPacketCountArray)));
    par1PlayerUsageSnooper.addData(
        "avg_sent_packet_size",
        Integer.valueOf((int) MathHelper.average(this.sentPacketSizeArray)));
    par1PlayerUsageSnooper.addData(
        "avg_rec_packet_count",
        Integer.valueOf((int) MathHelper.average(this.receivedPacketCountArray)));
    par1PlayerUsageSnooper.addData(
        "avg_rec_packet_size",
        Integer.valueOf((int) MathHelper.average(this.receivedPacketSizeArray)));
    int i = 0;

    for (int j = 0; j < this.worldServers.length; ++j) {
      if (this.worldServers[j] != null) {
        WorldServer worldserver = this.worldServers[j];
        WorldInfo worldinfo = worldserver.getWorldInfo();
        par1PlayerUsageSnooper.addData(
            "world[" + i + "][dimension]", Integer.valueOf(worldserver.provider.dimensionId));
        par1PlayerUsageSnooper.addData("world[" + i + "][mode]", worldinfo.getGameType());
        par1PlayerUsageSnooper.addData(
            "world[" + i + "][difficulty]", Integer.valueOf(worldserver.difficultySetting));
        par1PlayerUsageSnooper.addData(
            "world[" + i + "][hardcore]", Boolean.valueOf(worldinfo.isHardcoreModeEnabled()));
        par1PlayerUsageSnooper.addData(
            "world[" + i + "][generator_name]", worldinfo.getTerrainType().getWorldTypeName());
        par1PlayerUsageSnooper.addData(
            "world[" + i + "][generator_version]",
            Integer.valueOf(worldinfo.getTerrainType().getGeneratorVersion()));
        par1PlayerUsageSnooper.addData(
            "world[" + i + "][height]", Integer.valueOf(this.buildLimit));
        par1PlayerUsageSnooper.addData(
            "world[" + i + "][chunks_loaded]",
            Integer.valueOf(worldserver.getChunkProvider().getLoadedChunkCount()));
        ++i;
      }
    }

    par1PlayerUsageSnooper.addData("worlds", Integer.valueOf(i));
  }
Esempio n. 3
0
  public void addServerStatsToSnooper(PlayerUsageSnooper playerSnooper) {
    playerSnooper.addClientStat("whitelist_enabled", Boolean.valueOf(false));
    playerSnooper.addClientStat("whitelist_count", Integer.valueOf(0));

    if (this.serverConfigManager != null) {
      playerSnooper.addClientStat("players_current", Integer.valueOf(this.getCurrentPlayerCount()));
      playerSnooper.addClientStat("players_max", Integer.valueOf(this.getMaxPlayers()));
      playerSnooper.addClientStat(
          "players_seen", Integer.valueOf(this.serverConfigManager.getAvailablePlayerDat().length));
    }

    playerSnooper.addClientStat("uses_auth", Boolean.valueOf(this.onlineMode));
    playerSnooper.addClientStat("gui_state", this.getGuiEnabled() ? "enabled" : "disabled");
    playerSnooper.addClientStat(
        "run_time",
        Long.valueOf(
            (getCurrentTimeMillis() - playerSnooper.getMinecraftStartTimeMillis()) / 60L * 1000L));
    playerSnooper.addClientStat(
        "avg_tick_ms", Integer.valueOf((int) (MathHelper.average(this.tickTimeArray) * 1.0E-6D)));
    int var2 = 0;

    if (this.worldServers != null) {
      for (int var3 = 0; var3 < this.worldServers.length; ++var3) {
        if (this.worldServers[var3] != null) {
          WorldServer var4 = this.worldServers[var3];
          WorldInfo var5 = var4.getWorldInfo();
          playerSnooper.addClientStat(
              "world[" + var2 + "][dimension]", Integer.valueOf(var4.provider.getDimensionId()));
          playerSnooper.addClientStat("world[" + var2 + "][mode]", var5.getGameType());
          playerSnooper.addClientStat("world[" + var2 + "][difficulty]", var4.getDifficulty());
          playerSnooper.addClientStat(
              "world[" + var2 + "][hardcore]", Boolean.valueOf(var5.isHardcoreModeEnabled()));
          playerSnooper.addClientStat(
              "world[" + var2 + "][generator_name]", var5.getTerrainType().getWorldTypeName());
          playerSnooper.addClientStat(
              "world[" + var2 + "][generator_version]",
              Integer.valueOf(var5.getTerrainType().getGeneratorVersion()));
          playerSnooper.addClientStat(
              "world[" + var2 + "][height]", Integer.valueOf(this.buildLimit));
          playerSnooper.addClientStat(
              "world[" + var2 + "][chunks_loaded]",
              Integer.valueOf(var4.getChunkProvider().getLoadedChunkCount()));
          ++var2;
        }
      }
    }

    playerSnooper.addClientStat("worlds", Integer.valueOf(var2));
  }
  public String func_85112_a() {
    String var1 = "Unknown?";

    try {
      switch (WorldInfo.func_85121_j(this.field_85113_a)) {
        case 19132:
          var1 = "McRegion";
          break;
        case 19133:
          var1 = "Anvil";
      }
    } catch (Throwable var3) {;
    }

    return String.format(
        "0x%05X - %s",
        new Object[] {Integer.valueOf(WorldInfo.func_85121_j(this.field_85113_a)), var1});
  }
  protected void actionPerformed(GuiButton p_146284_1_) {
    if (p_146284_1_.id == 0) {
      this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
    }

    if (p_146284_1_.id == 5) {
      this.mc.displayGuiScreen(
          new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager()));
    }

    if (p_146284_1_.id == 1) {
      this.mc.displayGuiScreen(new GuiSelectWorld(this));
    }

    if (p_146284_1_.id == 2) {
      this.mc.displayGuiScreen(new GuiMultiplayer(this));
    }

    if (p_146284_1_.id == 14 && this.minecraftRealmsButton.visible) {
      this.func_140005_i();
    }

    if (p_146284_1_.id == 4) {
      this.mc.shutdown();
    }

    if (p_146284_1_.id == 6) {
      this.mc.displayGuiScreen(new GuiModList(this));
    }

    if (p_146284_1_.id == 11) {
      this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings);
    }

    if (p_146284_1_.id == 12) {
      ISaveFormat isaveformat = this.mc.getSaveLoader();
      WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");

      if (worldinfo != null) {
        GuiYesNo guiyesno = GuiSelectWorld.func_146623_a(this, worldinfo.getWorldName(), 12);
        this.mc.displayGuiScreen(guiyesno);
      }
    }
  }
  public static void setSpawnPoint(int dimension, int spawnX, int spawnY, int spawnZ) {
    World dimensionWorld = DimensionManager.getWorld(dimension);
    if (dimensionWorld instanceof WorldServerMulti) {
      WorldServerMulti w = (WorldServerMulti) DimensionManager.getWorld(dimension);
      DerivedWorldInfo worldInfo = (DerivedWorldInfo) w.getWorldInfo();

      try {
        Field f = DerivedWorldInfo.class.getDeclaredField(MCPNames.field("field_76115_a"));
        f.setAccessible(true);
        WorldInfo info = (WorldInfo) f.get(worldInfo);
        info.setSpawnPosition(spawnX, spawnY, spawnZ);
      } catch (Exception e) {
        PerfectSpawn.instance.logger.log(Level.ERROR, "Couldn't set spawn position");
        e.printStackTrace();
      }
    } else {
      WorldInfo info = dimensionWorld.getWorldInfo();
      info.setSpawnPosition(spawnX, spawnY, spawnZ);
    }
  }
  protected void actionPerformed(GuiButton p_146284_1_) {
    if (p_146284_1_.id == 0) {
      this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
    }

    if (p_146284_1_.id == 5) {
      this.mc.displayGuiScreen(
          new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager()));
    }

    if (p_146284_1_.id == 1) {
      this.mc.displayGuiScreen(new GuiSelectWorld(this));
    }

    if (p_146284_1_.id == 2) {
      this.mc.displayGuiScreen(new GuiMultiplayer(this));
    }

    if (p_146284_1_.id == 14) {
      this.func_140005_i();
    }

    if (p_146284_1_.id == 4) {
      this.mc.shutdown();
    }

    if (p_146284_1_.id == 11) {
      this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings);
    }

    if (p_146284_1_.id == 12) {
      ISaveFormat var2 = this.mc.getSaveLoader();
      WorldInfo var3 = var2.getWorldInfo("Demo_World");

      if (var3 != null) {
        GuiYesNo var4 = GuiSelectWorld.func_152129_a(this, var3.getWorldName(), 12);
        this.mc.displayGuiScreen(var4);
      }
    }
  }
Esempio n. 8
0
  protected void func_73875_a(GuiButton p_73875_1_) {
    if (p_73875_1_.field_73741_f == 0) {
      this.field_73882_e.func_71373_a(new GuiOptions(this, this.field_73882_e.field_71474_y));
    }

    if (p_73875_1_.field_73741_f == 5) {
      this.field_73882_e.func_71373_a(
          new GuiLanguage(
              this, this.field_73882_e.field_71474_y, this.field_73882_e.func_135016_M()));
    }

    if (p_73875_1_.field_73741_f == 1) {
      this.field_73882_e.func_71373_a(new GuiSelectWorld(this));
    }

    if (p_73875_1_.field_73741_f == 2) {
      this.field_73882_e.func_71373_a(new GuiMultiplayer(this));
    }

    if (p_73875_1_.field_73741_f == 14 && this.field_130023_H.field_73748_h) {
      this.func_140005_i();
    }

    if (p_73875_1_.field_73741_f == 4) {
      this.field_73882_e.func_71400_g();
    }

    if (p_73875_1_.field_73741_f == 11) {
      this.field_73882_e.func_71371_a("Demo_World", "Demo_World", DemoWorldServer.field_73071_a);
    }

    if (p_73875_1_.field_73741_f == 12) {
      ISaveFormat var2 = this.field_73882_e.func_71359_d();
      WorldInfo var3 = var2.func_75803_c("Demo_World");
      if (var3 != null) {
        GuiYesNo var4 = GuiSelectWorld.func_74061_a(this, var3.func_76065_j(), 12);
        this.field_73882_e.func_71373_a(var4);
      }
    }
  }
 public void func_73866_w_() {
   Keyboard.enableRepeatEvents(true);
   this.field_146292_n.clear();
   this.field_146292_n.add(
       new GuiButton(
           0,
           this.field_146294_l / 2 - 100,
           this.field_146295_m / 4 + 96 + 12,
           I18n.func_135052_a("selectWorld.renameButton", new Object[0])));
   this.field_146292_n.add(
       new GuiButton(
           1,
           this.field_146294_l / 2 - 100,
           this.field_146295_m / 4 + 120 + 12,
           I18n.func_135052_a("gui.cancel", new Object[0])));
   ISaveFormat var1 = this.field_146297_k.func_71359_d();
   WorldInfo var2 = var1.func_75803_c(this.field_146584_g);
   String var3 = var2.func_76065_j();
   this.field_146583_f =
       new GuiTextField(2, this.field_146289_q, this.field_146294_l / 2 - 100, 60, 200, 20);
   this.field_146583_f.func_146195_b(true);
   this.field_146583_f.func_146180_a(var3);
 }
Esempio n. 10
0
 public void handleWorldDataLoad(
     SaveHandler handler, WorldInfo worldInfo, NBTTagCompound tagCompound) {
   if (getEffectiveSide() != Side.SERVER) {
     return;
   }
   if (handlerSet.contains(handler)) {
     return;
   }
   handlerSet.add(handler);
   Map<String, NBTBase> additionalProperties = Maps.newHashMap();
   worldInfo.setAdditionalProperties(additionalProperties);
   for (ModContainer mc : Loader.instance().getModList()) {
     if (mc instanceof InjectedModContainer) {
       WorldAccessContainer wac = ((InjectedModContainer) mc).getWrappedWorldAccessContainer();
       if (wac != null) {
         wac.readData(
             handler, worldInfo, additionalProperties, tagCompound.func_74775_l(mc.getModId()));
       }
     }
   }
 }
Esempio n. 11
0
  @SideOnly(Side.CLIENT)
  public List func_75799_b() throws AnvilConverterException {
    ArrayList var1 = new ArrayList();

    for (int var2 = 0; var2 < 5; ++var2) {
      String var3 = "World" + (var2 + 1);
      WorldInfo var4 = this.func_75803_c(var3);
      if (var4 != null) {
        var1.add(
            new SaveFormatComparator(
                var3,
                "",
                var4.func_76057_l(),
                var4.func_76092_g(),
                var4.func_76077_q(),
                false,
                var4.func_76093_s(),
                var4.func_76086_u()));
      }
    }

    return var1;
  }
Esempio n. 12
0
  /** Callback when the command is invoked */
  public void processCommand(ICommandSender sender, String[] args) throws CommandException {
    if (args.length >= 1 && args.length <= 2) {
      int i = (300 + (new Random()).nextInt(600)) * 20;

      if (args.length >= 2) {
        i = parseInt(args[1], 1, 1000000) * 20;
      }

      World world = MinecraftServer.getServer().worldServers[0];
      WorldInfo worldinfo = world.getWorldInfo();

      if ("clear".equalsIgnoreCase(args[0])) {
        worldinfo.setCleanWeatherTime(i);
        worldinfo.setRainTime(0);
        worldinfo.setThunderTime(0);
        worldinfo.setRaining(false);
        worldinfo.setThundering(false);
        notifyOperators(sender, this, "commands.weather.clear", new Object[0]);
      } else if ("rain".equalsIgnoreCase(args[0])) {
        worldinfo.setCleanWeatherTime(0);
        worldinfo.setRainTime(i);
        worldinfo.setThunderTime(i);
        worldinfo.setRaining(true);
        worldinfo.setThundering(false);
        notifyOperators(sender, this, "commands.weather.rain", new Object[0]);
      } else {
        if (!"thunder".equalsIgnoreCase(args[0])) {
          throw new WrongUsageException("commands.weather.usage", new Object[0]);
        }

        worldinfo.setCleanWeatherTime(0);
        worldinfo.setRainTime(i);
        worldinfo.setThunderTime(i);
        worldinfo.setRaining(true);
        worldinfo.setThundering(true);
        notifyOperators(sender, this, "commands.weather.thunder", new Object[0]);
      }
    } else {
      throw new WrongUsageException("commands.weather.usage", new Object[0]);
    }
  }
Esempio n. 13
0
  protected void loadAllWorlds(
      String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) {
    this.convertMapIfNeeded(p_71247_1_);
    this.setUserMessage("menu.loadingLevel");
    this.worldServers = new WorldServer[3];
    this.timeOfLastDimensionTick = new long[this.worldServers.length][100];
    ISaveHandler var7 = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true);
    this.setResourcePackFromWorld(this.getFolderName(), var7);
    WorldInfo var9 = var7.loadWorldInfo();
    WorldSettings var8;

    if (var9 == null) {
      if (this.isDemo()) {
        var8 = DemoWorldServer.demoWorldSettings;
      } else {
        var8 =
            new WorldSettings(
                seed, this.getGameType(), this.canStructuresSpawn(), this.isHardcore(), type);
        var8.setWorldName(p_71247_6_);

        if (this.enableBonusChest) {
          var8.enableBonusChest();
        }
      }

      var9 = new WorldInfo(var8, p_71247_2_);
    } else {
      var9.setWorldName(p_71247_2_);
      var8 = new WorldSettings(var9);
    }

    for (int var10 = 0; var10 < this.worldServers.length; ++var10) {
      byte var11 = 0;

      if (var10 == 1) {
        var11 = -1;
      }

      if (var10 == 2) {
        var11 = 1;
      }

      if (var10 == 0) {
        if (this.isDemo()) {
          this.worldServers[var10] =
              (WorldServer) (new DemoWorldServer(this, var7, var9, var11, this.theProfiler)).init();
        } else {
          this.worldServers[var10] =
              (WorldServer) (new WorldServer(this, var7, var9, var11, this.theProfiler)).init();
        }

        this.worldServers[var10].initialize(var8);
      } else {
        this.worldServers[var10] =
            (WorldServer)
                (new WorldServerMulti(this, var7, var11, this.worldServers[0], this.theProfiler))
                    .init();
      }

      this.worldServers[var10].addWorldAccess(new WorldManager(this, this.worldServers[var10]));

      if (!this.isSinglePlayer()) {
        this.worldServers[var10].getWorldInfo().setGameType(this.getGameType());
      }
    }

    this.serverConfigManager.setPlayerManager(this.worldServers);
    this.setDifficultyForAllWorlds(this.getDifficulty());
    this.initialWorldChunkLoad();
  }
Esempio n. 14
0
 @Override
 public ChunkCoordinates getSpawnPoint() {
   WorldInfo info = worldObj.getWorldInfo();
   return new ChunkCoordinates(info.getSpawnX(), info.getSpawnY(), info.getSpawnZ());
 }
  public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn) {
    GameProfile var3 = playerIn.getGameProfile();
    PlayerProfileCache var4 = this.mcServer.getPlayerProfileCache();
    GameProfile var5 = var4.func_152652_a(var3.getId());
    String var6 = var5 == null ? var3.getName() : var5.getName();
    var4.func_152649_a(var3);
    NBTTagCompound var7 = this.readPlayerDataFromFile(playerIn);
    playerIn.setWorld(this.mcServer.worldServerForDimension(playerIn.dimension));
    playerIn.theItemInWorldManager.setWorld((WorldServer) playerIn.worldObj);
    String var8 = "local";

    if (netManager.getRemoteAddress() != null) {
      var8 = netManager.getRemoteAddress().toString();
    }

    logger.info(
        playerIn.getName()
            + "["
            + var8
            + "] logged in with entity id "
            + playerIn.getEntityId()
            + " at ("
            + playerIn.posX
            + ", "
            + playerIn.posY
            + ", "
            + playerIn.posZ
            + ")");
    WorldServer var9 = this.mcServer.worldServerForDimension(playerIn.dimension);
    WorldInfo var10 = var9.getWorldInfo();
    BlockPos var11 = var9.getSpawnPoint();
    this.func_72381_a(playerIn, (EntityPlayerMP) null, var9);
    NetHandlerPlayServer var12 = new NetHandlerPlayServer(this.mcServer, netManager, playerIn);
    var12.sendPacket(
        new S01PacketJoinGame(
            playerIn.getEntityId(),
            playerIn.theItemInWorldManager.getGameType(),
            var10.isHardcoreModeEnabled(),
            var9.provider.getDimensionId(),
            var9.getDifficulty(),
            this.getMaxPlayers(),
            var10.getTerrainType(),
            var9.getGameRules().getGameRuleBooleanValue("reducedDebugInfo")));
    var12.sendPacket(
        new S3FPacketCustomPayload(
            "MC|Brand",
            (new PacketBuffer(Unpooled.buffer()))
                .writeString(this.getServerInstance().getServerModName())));
    var12.sendPacket(
        new S41PacketServerDifficulty(var10.getDifficulty(), var10.isDifficultyLocked()));
    var12.sendPacket(new S05PacketSpawnPosition(var11));
    var12.sendPacket(new S39PacketPlayerAbilities(playerIn.capabilities));
    var12.sendPacket(new S09PacketHeldItemChange(playerIn.inventory.currentItem));
    playerIn.getStatFile().func_150877_d();
    playerIn.getStatFile().func_150884_b(playerIn);
    this.func_96456_a((ServerScoreboard) var9.getScoreboard(), playerIn);
    this.mcServer.refreshStatusNextTick();
    ChatComponentTranslation var13;

    if (!playerIn.getName().equalsIgnoreCase(var6)) {
      var13 =
          new ChatComponentTranslation(
              "multiplayer.player.joined.renamed", new Object[] {playerIn.getDisplayName(), var6});
    } else {
      var13 =
          new ChatComponentTranslation(
              "multiplayer.player.joined", new Object[] {playerIn.getDisplayName()});
    }

    var13.getChatStyle().setColor(EnumChatFormatting.YELLOW);
    this.sendChatMsg(var13);
    this.playerLoggedIn(playerIn);
    var12.setPlayerLocation(
        playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch);
    this.updateTimeAndWeatherForPlayer(playerIn, var9);

    if (this.mcServer.getResourcePackUrl().length() > 0) {
      playerIn.func_175397_a(
          this.mcServer.getResourcePackUrl(), this.mcServer.getResourcePackHash());
    }

    Iterator var14 = playerIn.getActivePotionEffects().iterator();

    while (var14.hasNext()) {
      PotionEffect var15 = (PotionEffect) var14.next();
      var12.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), var15));
    }

    playerIn.addSelfToInternalCraftingInventory();

    if (var7 != null && var7.hasKey("Riding", 10)) {
      Entity var16 = EntityList.createEntityFromNBT(var7.getCompoundTag("Riding"), var9);

      if (var16 != null) {
        var16.forceSpawn = true;
        var9.spawnEntityInWorld(var16);
        playerIn.mountEntity(var16);
        var16.forceSpawn = false;
      }
    }
  }
 public String func_85134_a() {
   return CrashReportCategory.func_85071_a(
       WorldInfo.func_85125_d(this.field_85135_a),
       WorldInfo.func_85124_e(this.field_85135_a),
       WorldInfo.func_85123_f(this.field_85135_a));
 }
Esempio n. 17
0
 protected void toggleDownfall() {
   WorldInfo worldinfo = MinecraftServer.getServer().worldServers[0].getWorldInfo();
   worldinfo.setRaining(!worldinfo.isRaining());
 }