Java 类net.minecraft.network.packet.Packet51MapChunk 实例源码

项目:RuneCraftery    文件:NetClientHandler.java   
public void func_72463_a(Packet51MapChunk p_72463_1_) {
   if(p_72463_1_.field_73598_e) {
      if(p_72463_1_.field_73600_c == 0) {
         this.field_72564_i.func_73025_a(p_72463_1_.field_73601_a, p_72463_1_.field_73599_b, false);
         return;
      }

      this.field_72564_i.func_73025_a(p_72463_1_.field_73601_a, p_72463_1_.field_73599_b, true);
   }

   this.field_72564_i.func_73031_a(p_72463_1_.field_73601_a << 4, 0, p_72463_1_.field_73599_b << 4, (p_72463_1_.field_73601_a << 4) + 15, 256, (p_72463_1_.field_73599_b << 4) + 15);
   Chunk var2 = this.field_72564_i.func_72964_e(p_72463_1_.field_73601_a, p_72463_1_.field_73599_b);
   if(p_72463_1_.field_73598_e && var2 == null) {
      this.field_72564_i.func_73025_a(p_72463_1_.field_73601_a, p_72463_1_.field_73599_b, true);
      var2 = this.field_72564_i.func_72964_e(p_72463_1_.field_73601_a, p_72463_1_.field_73599_b);
   }

   if(var2 != null) {
      var2.func_76607_a(p_72463_1_.func_73593_d(), p_72463_1_.field_73600_c, p_72463_1_.field_73597_d, p_72463_1_.field_73598_e);
      this.field_72564_i.func_72909_d(p_72463_1_.field_73601_a << 4, 0, p_72463_1_.field_73599_b << 4, (p_72463_1_.field_73601_a << 4) + 15, 256, (p_72463_1_.field_73599_b << 4) + 15);
      if(!p_72463_1_.field_73598_e || !(this.field_72564_i.field_73011_w instanceof WorldProviderSurface)) {
         var2.func_76613_n();
      }
   }

}
项目:RuneCraftery    文件:PlayerInstance.java   
public void func_73252_b(EntityPlayerMP p_73252_1_) {
   if(this.field_73263_b.contains(p_73252_1_)) {
      Chunk var2 = PlayerManager.func_72692_a(this.field_73265_a).func_72964_e(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b);
      p_73252_1_.field_71135_a.func_72567_b(new Packet51MapChunk(var2, true, 0));
      this.field_73263_b.remove(p_73252_1_);
      p_73252_1_.field_71129_f.remove(this.field_73264_c);
      if(this.field_73263_b.isEmpty()) {
         long var3 = (long)this.field_73264_c.field_77276_a + 2147483647L | (long)this.field_73264_c.field_77275_b + 2147483647L << 32;
         this.func_111196_a(var2);
         PlayerManager.func_72689_b(this.field_73265_a).func_76159_d(var3);
         PlayerManager.func_111191_d(this.field_73265_a).remove(this);
         if(this.field_73262_e > 0) {
            PlayerManager.func_72682_c(this.field_73265_a).remove(this);
         }

         this.field_73265_a.func_72688_a().field_73059_b.func_73241_b(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b);
      }

   }
}
项目:forge_world_downloader    文件:WDLNetClientHandler.java   
public void handleMapChunk(Packet51MapChunk mapChunk)
{
    if (wc == null)
    {
        wc = (WorldClient)Reflexion.stealField(NetClientHandler.class, WorldClient.class).get(nch);
    }

    if (mapChunk.includeInitialize)
    {
        if (mapChunk.yChMin == 0)
        {
            doPreChunk(mapChunk.xCh, mapChunk.zCh, false);
            return;
        }

        doPreChunk(mapChunk.xCh, mapChunk.zCh, true);
    }

    wc.invalidateBlockReceiveRegion(mapChunk.xCh << 4, 0, mapChunk.zCh << 4, (mapChunk.xCh << 4) + 15, 256, (mapChunk.zCh << 4) + 15);
    Chunk chunk = wc.getChunkFromChunkCoords(mapChunk.xCh, mapChunk.zCh);

    if (mapChunk.includeInitialize && chunk == null)
    {
        doPreChunk(mapChunk.xCh, mapChunk.zCh, true);
        chunk = wc.getChunkFromChunkCoords(mapChunk.xCh, mapChunk.zCh);
    }

    if (chunk != null)
    {
        chunk.fillChunk(mapChunk.getCompressedChunkData(), mapChunk.yChMin, mapChunk.yChMax, mapChunk.includeInitialize);
        wc.markBlockRangeForRenderUpdate(mapChunk.xCh << 4, 0, mapChunk.zCh << 4, (mapChunk.xCh << 4) + 15, 256, (mapChunk.zCh << 4) + 15);

        if (!mapChunk.includeInitialize || !(wc.provider instanceof WorldProviderSurface))
        {
            chunk.resetRelightChecks();
        }
    }
}
项目:RuneCraftery    文件:Packet56MapChunks.java   
public Packet56MapChunks(List p_i1437_1_) {
   int var2 = p_i1437_1_.size();
   this.field_73589_c = new int[var2];
   this.field_73586_d = new int[var2];
   this.field_73590_a = new int[var2];
   this.field_73588_b = new int[var2];
   this.field_73584_f = new byte[var2][];
   this.field_92076_h = !p_i1437_1_.isEmpty() && !((Chunk)p_i1437_1_.get(0)).field_76637_e.field_73011_w.field_76576_e;
   int var3 = 0;

   for(int var4 = 0; var4 < var2; ++var4) {
      Chunk var5 = (Chunk)p_i1437_1_.get(var4);
      Packet51MapChunkData var6 = Packet51MapChunk.func_73594_a(var5, true, '\uffff');
      if(field_73591_h.length < var3 + var6.field_74582_a.length) {
         byte[] var7 = new byte[var3 + var6.field_74582_a.length];
         System.arraycopy(field_73591_h, 0, var7, 0, field_73591_h.length);
         field_73591_h = var7;
      }

      System.arraycopy(var6.field_74582_a, 0, field_73591_h, var3, var6.field_74582_a.length);
      var3 += var6.field_74582_a.length;
      this.field_73589_c[var4] = var5.field_76635_g;
      this.field_73586_d[var4] = var5.field_76647_h;
      this.field_73590_a[var4] = var6.field_74580_b;
      this.field_73588_b[var4] = var6.field_74581_c;
      this.field_73584_f[var4] = var6.field_74582_a;
   }

   Deflater var11 = new Deflater(-1);

   try {
      var11.setInput(field_73591_h, 0, var3);
      var11.finish();
      this.field_73587_e = new byte[var3];
      this.field_73585_g = var11.deflate(this.field_73587_e);
   } finally {
      var11.end();
   }

}
项目:RuneCraftery    文件:NetClientHandler.java   
/**
 * Handle Packet51MapChunk (full chunk update of blocks, metadata, light levels, and optionally biome data)
 */
public void handleMapChunk(Packet51MapChunk par1Packet51MapChunk)
{
    if (par1Packet51MapChunk.includeInitialize)
    {
        if (par1Packet51MapChunk.yChMin == 0)
        {
            this.worldClient.doPreChunk(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh, false);
            return;
        }

        this.worldClient.doPreChunk(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh, true);
    }

    this.worldClient.invalidateBlockReceiveRegion(par1Packet51MapChunk.xCh << 4, 0, par1Packet51MapChunk.zCh << 4, (par1Packet51MapChunk.xCh << 4) + 15, 256, (par1Packet51MapChunk.zCh << 4) + 15);
    Chunk chunk = this.worldClient.getChunkFromChunkCoords(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh);

    if (par1Packet51MapChunk.includeInitialize && chunk == null)
    {
        this.worldClient.doPreChunk(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh, true);
        chunk = this.worldClient.getChunkFromChunkCoords(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh);
    }

    if (chunk != null)
    {
        chunk.fillChunk(par1Packet51MapChunk.getCompressedChunkData(), par1Packet51MapChunk.yChMin, par1Packet51MapChunk.yChMax, par1Packet51MapChunk.includeInitialize);
        this.worldClient.markBlockRangeForRenderUpdate(par1Packet51MapChunk.xCh << 4, 0, par1Packet51MapChunk.zCh << 4, (par1Packet51MapChunk.xCh << 4) + 15, 256, (par1Packet51MapChunk.zCh << 4) + 15);

        if (!par1Packet51MapChunk.includeInitialize || !(this.worldClient.provider instanceof WorldProviderSurface))
        {
            chunk.resetRelightChecks();
        }
    }
}
项目:RuneCraftery    文件:PlayerInstance.java   
public void removePlayer(EntityPlayerMP par1EntityPlayerMP)
{
    if (this.playersInChunk.contains(par1EntityPlayerMP))
    {
        Chunk chunk = PlayerManager.getWorldServer(this.thePlayerManager).getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos);
        par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet51MapChunk(chunk, 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;
            this.increaseInhabitedTime(chunk);
            PlayerManager.getChunkWatchers(this.thePlayerManager).remove(i);
            PlayerManager.getChunkWatcherList(this.thePlayerManager).remove(this);

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

            this.thePlayerManager.getWorldServer().theChunkProviderServer.unloadChunksIfNotNearSpawn(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos);
        }
    }
}
项目:BetterNutritionMod    文件:NetClientHandler.java   
/**
 * Handle Packet51MapChunk (full chunk update of blocks, metadata, light levels, and optionally biome data)
 */
public void handleMapChunk(Packet51MapChunk par1Packet51MapChunk)
{
    if (par1Packet51MapChunk.includeInitialize)
    {
        if (par1Packet51MapChunk.yChMin == 0)
        {
            this.worldClient.doPreChunk(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh, false);
            return;
        }

        this.worldClient.doPreChunk(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh, true);
    }

    this.worldClient.invalidateBlockReceiveRegion(par1Packet51MapChunk.xCh << 4, 0, par1Packet51MapChunk.zCh << 4, (par1Packet51MapChunk.xCh << 4) + 15, 256, (par1Packet51MapChunk.zCh << 4) + 15);
    Chunk chunk = this.worldClient.getChunkFromChunkCoords(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh);

    if (par1Packet51MapChunk.includeInitialize && chunk == null)
    {
        this.worldClient.doPreChunk(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh, true);
        chunk = this.worldClient.getChunkFromChunkCoords(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh);
    }

    if (chunk != null)
    {
        chunk.fillChunk(par1Packet51MapChunk.getCompressedChunkData(), par1Packet51MapChunk.yChMin, par1Packet51MapChunk.yChMax, par1Packet51MapChunk.includeInitialize);
        this.worldClient.markBlockRangeForRenderUpdate(par1Packet51MapChunk.xCh << 4, 0, par1Packet51MapChunk.zCh << 4, (par1Packet51MapChunk.xCh << 4) + 15, 256, (par1Packet51MapChunk.zCh << 4) + 15);

        if (!par1Packet51MapChunk.includeInitialize || !(this.worldClient.provider instanceof WorldProviderSurface))
        {
            chunk.resetRelightChecks();
        }
    }
}
项目:BetterNutritionMod    文件:PlayerInstance.java   
public void removePlayer(EntityPlayerMP par1EntityPlayerMP)
{
    if (this.playersInChunk.contains(par1EntityPlayerMP))
    {
        Chunk chunk = PlayerManager.getWorldServer(this.thePlayerManager).getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos);
        par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet51MapChunk(chunk, 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;
            this.increaseInhabitedTime(chunk);
            PlayerManager.getChunkWatchers(this.thePlayerManager).remove(i);
            PlayerManager.getChunkWatcherList(this.thePlayerManager).remove(this);

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

            this.thePlayerManager.getWorldServer().theChunkProviderServer.unloadChunksIfNotNearSpawn(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos);
        }
    }
}
项目:RuneCraftery    文件:PlayerInstance.java   
public void func_73254_a() {
   if(this.field_73262_e != 0) {
      int var1;
      int var2;
      int var3;
      if(this.field_73262_e == 1) {
         var1 = this.field_73264_c.field_77276_a * 16 + (this.field_73261_d[0] >> 12 & 15);
         var2 = this.field_73261_d[0] & 255;
         var3 = this.field_73264_c.field_77275_b * 16 + (this.field_73261_d[0] >> 8 & 15);
         this.func_73256_a(new Packet53BlockChange(var1, var2, var3, PlayerManager.func_72692_a(this.field_73265_a)));
         if(PlayerManager.func_72692_a(this.field_73265_a).func_72927_d(var1, var2, var3)) {
            this.func_73257_a(PlayerManager.func_72692_a(this.field_73265_a).func_72796_p(var1, var2, var3));
         }
      } else {
         int var4;
         if(this.field_73262_e == 64) {
            var1 = this.field_73264_c.field_77276_a * 16;
            var2 = this.field_73264_c.field_77275_b * 16;
            this.func_73256_a(new Packet51MapChunk(PlayerManager.func_72692_a(this.field_73265_a).func_72964_e(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b), false, this.field_73260_f));

            for(var3 = 0; var3 < 16; ++var3) {
               if((this.field_73260_f & 1 << var3) != 0) {
                  var4 = var3 << 4;
                  List var5 = PlayerManager.func_72692_a(this.field_73265_a).func_73049_a(var1, var4, var2, var1 + 16, var4 + 16, var2 + 16);

                  for(int var6 = 0; var6 < var5.size(); ++var6) {
                     this.func_73257_a((TileEntity)var5.get(var6));
                  }
               }
            }
         } else {
            this.func_73256_a(new Packet52MultiBlockChange(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b, this.field_73261_d, this.field_73262_e, PlayerManager.func_72692_a(this.field_73265_a)));

            for(var1 = 0; var1 < this.field_73262_e; ++var1) {
               var2 = this.field_73264_c.field_77276_a * 16 + (this.field_73261_d[var1] >> 12 & 15);
               var3 = this.field_73261_d[var1] & 255;
               var4 = this.field_73264_c.field_77275_b * 16 + (this.field_73261_d[var1] >> 8 & 15);
               if(PlayerManager.func_72692_a(this.field_73265_a).func_72927_d(var2, var3, var4)) {
                  this.func_73257_a(PlayerManager.func_72692_a(this.field_73265_a).func_72796_p(var2, var3, var4));
               }
            }
         }
      }

      this.field_73262_e = 0;
      this.field_73260_f = 0;
   }
}
项目:RuneCraftery    文件:PlayerInstance.java   
public void sendChunkUpdate()
{
    if (this.numberOfTilesToUpdate != 0)
    {
        int i;
        int j;
        int k;

        if (this.numberOfTilesToUpdate == 1)
        {
            i = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[0] >> 12 & 15);
            j = this.locationOfBlockChange[0] & 255;
            k = this.chunkLocation.chunkZPos * 16 + (this.locationOfBlockChange[0] >> 8 & 15);
            this.sendToAllPlayersWatchingChunk(new Packet53BlockChange(i, j, k, PlayerManager.getWorldServer(this.thePlayerManager)));

            if (PlayerManager.getWorldServer(this.thePlayerManager).blockHasTileEntity(i, j, k))
            {
                this.sendTileToAllPlayersWatchingChunk(PlayerManager.getWorldServer(this.thePlayerManager).getBlockTileEntity(i, j, k));
            }
        }
        else
        {
            int l;

            if (this.numberOfTilesToUpdate >= ForgeDummyContainer.clumpingThreshold)
            {
                i = this.chunkLocation.chunkXPos * 16;
                j = this.chunkLocation.chunkZPos * 16;
                this.sendToAllPlayersWatchingChunk(new Packet51MapChunk(PlayerManager.getWorldServer(this.thePlayerManager).getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos), false, this.flagsYAreasToUpdate));

                /* Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones
                for (k = 0; k < 16; ++k)
                {
                    if ((this.flagsYAreasToUpdate & 1 << k) != 0)
                    {
                        l = k << 4;
                        List list = PlayerManager.getWorldServer(this.thePlayerManager).getAllTileEntityInBox(i, l, j, i + 16, l + 16, j + 16);

                        for (int i1 = 0; i1 < list.size(); ++i1)
                        {
                            this.sendTileToAllPlayersWatchingChunk((TileEntity)list.get(i1));
                        }
                    }
                }
                */
            }
            else
            {
                this.sendToAllPlayersWatchingChunk(new Packet52MultiBlockChange(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos, this.locationOfBlockChange, this.numberOfTilesToUpdate, PlayerManager.getWorldServer(this.thePlayerManager)));
            }

            { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small
                for (i = 0; i < this.numberOfTilesToUpdate; ++i)
                {
                    j = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[i] >> 12 & 15);
                    k = this.locationOfBlockChange[i] & 255;
                    l = this.chunkLocation.chunkZPos * 16 + (this.locationOfBlockChange[i] >> 8 & 15);

                    if (PlayerManager.getWorldServer(this.thePlayerManager).blockHasTileEntity(j, k, l))
                    {
                        this.sendTileToAllPlayersWatchingChunk(PlayerManager.getWorldServer(this.thePlayerManager).getBlockTileEntity(j, k, l));
                    }
                }
            }
        }

        this.numberOfTilesToUpdate = 0;
        this.flagsYAreasToUpdate = 0;
    }
}
项目:BetterNutritionMod    文件:PlayerInstance.java   
public void sendChunkUpdate()
{
    if (this.numberOfTilesToUpdate != 0)
    {
        int i;
        int j;
        int k;

        if (this.numberOfTilesToUpdate == 1)
        {
            i = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[0] >> 12 & 15);
            j = this.locationOfBlockChange[0] & 255;
            k = this.chunkLocation.chunkZPos * 16 + (this.locationOfBlockChange[0] >> 8 & 15);
            this.sendToAllPlayersWatchingChunk(new Packet53BlockChange(i, j, k, PlayerManager.getWorldServer(this.thePlayerManager)));

            if (PlayerManager.getWorldServer(this.thePlayerManager).blockHasTileEntity(i, j, k))
            {
                this.sendTileToAllPlayersWatchingChunk(PlayerManager.getWorldServer(this.thePlayerManager).getBlockTileEntity(i, j, k));
            }
        }
        else
        {
            int l;

            if (this.numberOfTilesToUpdate >= ForgeDummyContainer.clumpingThreshold)
            {
                i = this.chunkLocation.chunkXPos * 16;
                j = this.chunkLocation.chunkZPos * 16;
                this.sendToAllPlayersWatchingChunk(new Packet51MapChunk(PlayerManager.getWorldServer(this.thePlayerManager).getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos), false, this.flagsYAreasToUpdate));

                /* Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones
                for (k = 0; k < 16; ++k)
                {
                    if ((this.flagsYAreasToUpdate & 1 << k) != 0)
                    {
                        l = k << 4;
                        List list = PlayerManager.getWorldServer(this.thePlayerManager).getAllTileEntityInBox(i, l, j, i + 16, l + 16, j + 16);

                        for (int i1 = 0; i1 < list.size(); ++i1)
                        {
                            this.sendTileToAllPlayersWatchingChunk((TileEntity)list.get(i1));
                        }
                    }
                }
                */
            }
            else
            {
                this.sendToAllPlayersWatchingChunk(new Packet52MultiBlockChange(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos, this.locationOfBlockChange, this.numberOfTilesToUpdate, PlayerManager.getWorldServer(this.thePlayerManager)));
            }

            { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small
                for (i = 0; i < this.numberOfTilesToUpdate; ++i)
                {
                    j = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[i] >> 12 & 15);
                    k = this.locationOfBlockChange[i] & 255;
                    l = this.chunkLocation.chunkZPos * 16 + (this.locationOfBlockChange[i] >> 8 & 15);

                    if (PlayerManager.getWorldServer(this.thePlayerManager).blockHasTileEntity(j, k, l))
                    {
                        this.sendTileToAllPlayersWatchingChunk(PlayerManager.getWorldServer(this.thePlayerManager).getBlockTileEntity(j, k, l));
                    }
                }
            }
        }

        this.numberOfTilesToUpdate = 0;
        this.flagsYAreasToUpdate = 0;
    }
}
项目:RuneCraftery    文件:NetHandler.java   
public void func_72463_a(Packet51MapChunk p_72463_1_) {}