Package net.minecraft.server.management

Examples of net.minecraft.server.management.PlayerInstance


  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


        if (this.checkForBurnout(world, x, y, z, true)) {
          world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);

          if (world instanceof WorldServer) {
            PlayerInstance playerInstance = ((WorldServer) world).getPlayerManager().getOrCreateChunkWatcher(x >> 4, z >> 4, false);
            if (playerInstance != null) {
              playerInstance.sendToAllPlayersWatchingChunk(new Packet61DoorChange(2000, x, y, z, rand.nextInt(9), false));
              playerInstance.sendToAllPlayersWatchingChunk(new Packet61DoorChange(2000, x, y, z, rand.nextInt(9), false));
            }
          }
        }
      }
    } else if (!indirectlyPowered && !this.checkForBurnout(world, x, y, z, false)) {
View Full Code Here

    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

  }

  @Override
  @Declare
  public void sendTile() {
    PlayerInstance p = ((WorldServer) worldObj).getPlayerManager().getOrCreateChunkWatcher(xCoord >> 4, zCoord >> 4, false);
    if (p != null) {
      p.updateTile(this);
    }
  }
View Full Code Here

  @Override
  public void updatePlayerInstances() {
    int currentTick = MinecraftServer.currentTick;
    ArrayList<PlayerInstance> postponed = new ArrayList<PlayerInstance>();
    PlayerInstance playerInstance;
    while ((playerInstance = chunkWatcherWithPlayersQ.poll()) != null) {
      try {
        if (playerInstance.shouldPostPone(currentTick++ % 600 == 0, currentTick)) {
          postponed.add(playerInstance);
        } else {
          playerInstance.sendChunkUpdate();
        }
      } catch (Exception e) {
        Log.severe("Failed to send " + playerInstance, e);
        playerInstance.clearTileCount();
      }
    }

    chunkWatcherWithPlayersQ.addAll(postponed);
View Full Code Here

  }

  @Override
  public PlayerInstance getOrCreateChunkWatcher(int par1, int par2, boolean par3) {
    long var4 = (long) par1 + 2147483647L | (long) par2 + 2147483647L << 32;
    PlayerInstance var6 = (PlayerInstance) this.playerInstances.getValueByKey(var4);

    if (var6 == null && par3) {
      synchronized (chunkWatcherLock) {
        var6 = (PlayerInstance) this.playerInstances.getValueByKey(var4);
        if (var6 == null) {
          var6 = new PlayerInstance(this, par1, par2);
          this.playerInstances.add(var4, var6);
        }
      }
    }
View Full Code Here

      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();
          }
        }
      }
      sendChat(commandSender, "Refreshed " + count + " chunks");
      return;
View Full Code Here

TOP

Related Classes of net.minecraft.server.management.PlayerInstance

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.