Examples of WorldServer


Examples of net.minecraft.world.WorldServer

            player.addChatMessage(getLocalizedMessage(msg, args));
    }

    public static void sendLocalizedChatToAllFromServer(World world, String msg, Object... args) {
        if (world instanceof WorldServer) {
            WorldServer worldServer = (WorldServer) world;
            for (Object obj : worldServer.playerEntities) {
                if (obj instanceof EntityPlayer)
                    sendLocalizedChat((EntityPlayer) obj, msg, args);
            }
        }
View Full Code Here

Examples of net.minecraft.world.WorldServer

    return a * a;
  }

  @Declare
  public static void sendPacketAroundPlayer(EntityPlayerMP player, Packet packet, int squaredDistance) {
    WorldServer worldServer = ((WorldServer) player.worldObj);
    int cX = player.chunkCoordX;
    int cZ = player.chunkCoordZ;
    for (EntityPlayerMP entityPlayerMP : (Iterable<EntityPlayerMP>) worldServer.playerEntities) {
      if (entityPlayerMP != player && (square((entityPlayerMP.chunkCoordX - cX) << 4) + square((entityPlayerMP.chunkCoordZ - cZ) << 4)) < squaredDistance) {
        entityPlayerMP.playerNetServerHandler.sendPacketToPlayer(packet);
View Full Code Here

Examples of net.minecraft.world.WorldServer

      }
    }
  }

  public static void sendPacketToAllAround(double X, double Y, double Z, double range, int dimensionId, Packet packet) {
    WorldServer worldServer = MinecraftServer.getServer().worldServerForDimension(dimensionId);
    int x = MathHelper.floor_double(X);
    int z = MathHelper.floor_double(Z);
    PlayerInstance playerInstance = worldServer.getPlayerManager().getOrCreateChunkWatcher(x >> 4, z >> 4, false);
    if (playerInstance != null) {
      range *= range;
      synchronized (playerInstance) {
        for (EntityPlayerMP entityPlayerMP : (Iterable<EntityPlayerMP>) playerInstance.playersInChunk) {
          double xD = X - entityPlayerMP.posX;
View Full Code Here

Examples of net.minecraft.world.WorldServer

    }
  }

  @SubscribeEvent
  public void tick(WorldTickEvent evt) {
    WorldServer world = MinecraftServer.getServer().worldServers[0];
    long time = world.getTotalWorldTime();

    if (startTestTime == 0) {
      startTestTime = time;
    } else if (testSequence == null) {
      if (time - startTestTime > 10) {
View Full Code Here

Examples of net.minecraft.world.WorldServer

    if (sendClientUpdate) {
      sendClientUpdate = false;

      if (worldObj instanceof WorldServer) {
        WorldServer world = (WorldServer) worldObj;
        BuildCraftPacket updatePacket = getBCDescriptionPacket();

        for (Object o : world.playerEntities) {
          EntityPlayerMP player = (EntityPlayerMP) o;

          if (world.getPlayerManager().isPlayerWatchingChunk (player, xCoord >> 4, zCoord >> 4)) {
            BuildCraftCore.instance.sendToPlayer(player, updatePacket);
          }
        }
      }
    }
View Full Code Here

Examples of net.minecraft.world.WorldServer

  public volatile nallar.tickthreading.minecraft.tickregion.TileEntityTickRegion tickRegion_;

  @Override
  @Declare
  public void sendTileWithNotify() {
    WorldServer worldServer = ((WorldServer) worldObj);
    if (worldServer == null) {
      return;
    }
    Block blockType = getBlockType();
    worldServer.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, blockType == null ? worldServer.getBlockId(xCoord, yCoord, zCoord) : blockType.blockID);
    PlayerInstance p = worldServer.getPlayerManager().getOrCreateChunkWatcher(xCoord >> 4, zCoord >> 4, false);
    if (p != null) {
      p.updateTile(this);
    }
  }
View Full Code Here

Examples of net.minecraft.world.WorldServer

  public static void saveWorld(World world) {
    // only persist persistent worlds
    if (!(world instanceof WorldServer)) {
      return;
    }
    WorldServer worldServer = (WorldServer) world;
    File chunkDir = worldServer.getChunkSaveLocation();
    File chunkLoaderData = new File(chunkDir, "forcedchunks.dat");

    NBTTagCompound forcedChunkData = new NBTTagCompound();
    NBTTagList ticketList = new NBTTagList();
    forcedChunkData.setTag("TicketList", ticketList);
View Full Code Here

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

Examples of net.minecraft.world.WorldServer

    }

    @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

Examples of net.minecraft.world.WorldServer

        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
TOP
Copyright © 2018 www.massapi.com. 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.