Ejemplo n.º 1
0
  public void sendThisChunkToPlayer(EntityPlayerMP par1EntityPlayerMP) {
    if (this.playersInChunk.contains(par1EntityPlayerMP)) {
      par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(
          new Packet51MapChunk(
              PlayerManager.getWorldServer(this.thePlayerManager)
                  .getChunkFromChunkCoords(
                      this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos),
              true,
              0));
      this.playersInChunk.remove(par1EntityPlayerMP);
      par1EntityPlayerMP.loadedChunks.remove(this.chunkLocation);

      MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.UnWatch(chunkLocation, par1EntityPlayerMP));

      if (this.playersInChunk.isEmpty()) {
        long i =
            (long) this.chunkLocation.chunkXPos + 2147483647L
                | (long) this.chunkLocation.chunkZPos + 2147483647L << 32;
        PlayerManager.getChunkWatchers(this.thePlayerManager).remove(i);

        if (this.numberOfTilesToUpdate > 0) {
          PlayerManager.getChunkWatchersWithPlayers(this.thePlayerManager).remove(this);
        }

        this.thePlayerManager
            .getWorldServer()
            .theChunkProviderServer
            .unloadChunksIfNotNearSpawn(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos);
      }
    }
  }
Ejemplo n.º 2
0
  public void flagChunkForUpdate(int par1, int par2, int par3) {
    if (this.numberOfTilesToUpdate == 0) {
      PlayerManager.getChunkWatchersWithPlayers(this.thePlayerManager).add(this);
    }

    this.field_73260_f |= 1 << (par2 >> 4);

    // if (this.numberOfTilesToUpdate < 64) //Forge; Cache everything, so always run
    {
      short short1 = (short) (par1 << 12 | par3 << 8 | par2);

      for (int l = 0; l < this.numberOfTilesToUpdate; ++l) {
        if (this.locationOfBlockChange[l] == short1) {
          return;
        }
      }

      if (numberOfTilesToUpdate == locationOfBlockChange.length) {
        locationOfBlockChange =
            Arrays.copyOf(locationOfBlockChange, locationOfBlockChange.length << 1);
      }
      this.locationOfBlockChange[this.numberOfTilesToUpdate++] = short1;
    }
  }