Package net.minecraft.world

Examples of net.minecraft.world.WorldServer


    if (!(world instanceof WorldServer)) {
      return;
    }

    WorldServer worldServer = (WorldServer) world;
    File chunkDir = worldServer.getChunkSaveLocation();
    File chunkLoaderData = new File(chunkDir, "forcedchunks.dat");

    if (chunkLoaderData.exists() && chunkLoaderData.isFile()) {
      // MCPC+ force chunks later to help guarantee Forge event ordering
      ChunkProviderServer chunkProviderServer = worldServer.theChunkProviderServer;
View Full Code Here


    }

    @Override
    public void run() {
      try {
        WorldServer worldServer = provider.getWorld();
        if (worldServer.unloaded) {
          FMLLog.warning("Failed to load chunk at " + worldServer.getDimension() + ':' + x + ',' + z + " asynchronously. The world is no longer loaded.");
          return;
        }
        Chunk chunk = provider.getChunkAt(x, z, allowGenerate, regenerate, null);
        if (chunk == null || (allowGenerate && chunk instanceof EmptyChunk)) {
          FMLLog.warning("Failed to load chunk at " + Log.name(worldServer) + ':' + x + ',' + z + " asynchronously. Provided " + chunk);
View Full Code Here

        if (numberOfTilesToUpdate > locationOfBlockChange.length) {
          Log.warning("numberOfTilesToUpdate set too high. Got " + numberOfTilesToUpdate + " should be <= " + locationOfBlockChange.length);
          numberOfTilesToUpdate = locationOfBlockChange.length;
        }

        WorldServer worldServer = thePlayerManager.getWorldServer();
        Chunk chunk = this.chunk;
        if (numberOfTilesToUpdate == 1) {
          int x = chunkLocation.chunkXPos * 16 + (locationOfBlockChange[0] >> 12 & 15);
          int y = locationOfBlockChange[0] & 255;
          int z = chunkLocation.chunkZPos * 16 + (locationOfBlockChange[0] >> 8 & 15);
View Full Code Here

        entityPlayerMP = (EntityPlayerMP) commandSender;
      } catch (ClassCastException e) {
        sendChat(commandSender, "/ticks r can only be used in game.");
        return;
      }
      WorldServer worldServer = (WorldServer) entityPlayerMP.worldObj;
      int side = arguments.isEmpty() ? 2 : Integer.valueOf(arguments.get(0));
      int count = 0;
      for (int x = entityPlayerMP.chunkCoordX - side, eX = x + side + side; x < eX; x++) {
        for (int z = entityPlayerMP.chunkCoordZ - side, eZ = z + side + side; z < eZ; z++) {
          PlayerInstance playerInstance = worldServer.getPlayerManager().getOrCreateChunkWatcher(x, z, false);
          if (playerInstance != null) {
            count++;
            playerInstance.forceUpdate();
          }
        }
View Full Code Here

    int i;
    while ((i = currentWorld.getAndIncrement()) < dimensionIdsToTick.length) {
      int id = dimensionIdsToTick[i];
      long var2 = System.nanoTime();

      WorldServer world = DimensionManager.getWorld(id);
      String name = world.getName();
      if (!world.loadEventFired) {
        Log.severe("Not sent WorldEvent.Load for loaded world " + name + ", sending it now.");
        MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world));
      }
      if (world.getDimension() != id) {
        Log.severe("World " + world.getName() + " exists in DimensionManager with an apparently incorrect dimension ID of " + id);
        continue;
      }
      try {
        profiler.startSection(world.getWorldInfo().getWorldName());
        profiler.startSection("pools");
        world.getWorldVec3Pool().clear();
        profiler.endSection();

        int tickCount = world.tickCount;
        if (tickCount % 30 == 0) {
          profiler.startSection("timeSync");
          long totalTime = world.getTotalWorldTime();
          boolean doDaylightCycle = world.getGameRules().getGameRuleBooleanValue("doDaylightCycle");
          for (EntityPlayerMP entityPlayerMP : (Iterable<EntityPlayerMP>) world.playerEntities) {
            entityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet4UpdateTime(totalTime, entityPlayerMP.getPlayerTime(), doDaylightCycle));
          }
          profiler.endSection();
        }

        profiler.startSection("forgeTick");
        FMLCommonHandler.instance().onPreWorldTick(world);

        profiler.endStartSection("worldTick");
        world.tick();
        profiler.endStartSection("entityTick");
        world.updateEntities();
        profiler.endStartSection("postForgeTick");
        FMLCommonHandler.instance().onPostWorldTick(world);
        profiler.endSection();
        profiler.startSection("tracker");
        world.getEntityTracker().updateTrackedEntities();
        profiler.endSection();
        if (tickCount % 14 == 0) {
          exceptionCount.put(id, 0);
        }
        if (TickThreading.checkSaveInterval(tickCount)) {
          theProfiler.startSection("save");
          try {
            currentlySaving.getAndIncrement();
            long st = 0;
            boolean enabled = Timings.enabled;
            if (enabled) {
              st = System.nanoTime();
            }
            if (world.saveTickCount++ % 20 == 0) {
              world.saveAllChunks(false, null);
            } else {
              if (world.theChunkProviderServer.canSave()) {
                world.theChunkProviderServer.saveChunks(false, null);
              }
            }
View Full Code Here

  @Declare
  public java.util.concurrent.locks.Lock playersUpdateLock_;

  @Override
  public void transferPlayerToDimension(EntityPlayerMP entityPlayerMP, int toDimensionId, Teleporter teleporter) {
    WorldServer fromDimension;
    WorldServer toDimension;
    synchronized (entityPlayerMP.playerNetServerHandler) {
      synchronized (entityPlayerMP.loadedChunks) {
        int fromDimensionId = entityPlayerMP.dimension;
        fromDimension = this.mcServer.worldServerForDimension(fromDimensionId);
        entityPlayerMP.dimension = toDimensionId;
        toDimension = this.mcServer.worldServerForDimension(toDimensionId);
        if (fromDimension == toDimension) {
          if (!toDimension.playerEntities.contains(entityPlayerMP)) {
            toDimension.spawnEntityInWorld(entityPlayerMP);
          }
          Log.severe("Can't transfer player to the dimension they are already in! " + entityPlayerMP + ", dimension: " + Log.name(toDimension));
          return;
        }
        entityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(entityPlayerMP.dimension, (byte) entityPlayerMP.worldObj.difficultySetting, toDimension.getWorldInfo().getTerrainType(), toDimension.getHeight(), entityPlayerMP.theItemInWorldManager.getGameType()));
        fromDimension.playerEntities.remove(entityPlayerMP);
        fromDimension.loadedEntityList.remove(entityPlayerMP);
        fromDimension.onEntityRemoved(entityPlayerMP);
        fromDimension.updateAllPlayersSleepingFlag();
        int x = entityPlayerMP.chunkCoordX;
        int z = entityPlayerMP.chunkCoordZ;
        if (entityPlayerMP.addedToChunk && fromDimension.getChunkProvider().chunkExists(x, z)) {
          fromDimension.getChunkFromChunkCoords(x, z).removeEntity(entityPlayerMP);
        }
        this.transferEntityToWorld(entityPlayerMP, fromDimensionId, fromDimension, toDimension, teleporter);
        entityPlayerMP.setWorld(toDimension);
        toDimension.theChunkProviderServer.loadChunk((int) entityPlayerMP.posX >> 4, (int) entityPlayerMP.posZ >> 4);
        if (!toDimension.playerEntities.contains(entityPlayerMP)) {
          toDimension.spawnEntityInWorld(entityPlayerMP);
        }
        entityPlayerMP.playerNetServerHandler.setPlayerLocation(entityPlayerMP.posX, entityPlayerMP.posY, entityPlayerMP.posZ, entityPlayerMP.rotationYaw, entityPlayerMP.rotationPitch);
        entityPlayerMP.theItemInWorldManager.setWorld(toDimension);
        this.updateTimeAndWeatherForPlayer(entityPlayerMP, toDimension);
        this.syncPlayerInventory(entityPlayerMP);

        for (PotionEffect potionEffect : (Iterable<PotionEffect>) entityPlayerMP.getActivePotionEffects()) {
          entityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet41EntityEffect(entityPlayerMP.entityId, potionEffect));
        }

        GameRegistry.onPlayerChangedDimension(entityPlayerMP);
      }
      fromDimension.getPlayerManager().removePlayer(entityPlayerMP);
      toDimension.getPlayerManager().removePlayer(entityPlayerMP);
      toDimension.getPlayerManager().addPlayer(entityPlayerMP);
    }
  }
View Full Code Here

    int loadedChunks = 0;
    this.setUserMessage("menu.generatingTerrain");
    byte dimension = 0;
    long startTime = System.currentTimeMillis();
    getLogAgent().logInfo("Loading spawn area for dimension " + dimension);
    WorldServer worldServer = this.worldServers[dimension];
    ChunkCoordinates spawnPoint = worldServer.getSpawnPoint();

    for (int var11 = -192; var11 <= 192 && this.isServerRunning(); var11 += 16) {
      for (int var12 = -192; var12 <= 192 && this.isServerRunning(); var12 += 16) {
        long currentTime = System.currentTimeMillis();
View Full Code Here

TOP

Related Classes of net.minecraft.world.WorldServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.