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

项目:RuneCraftery    文件:NetClientHandler.java   
public void func_72496_a(Packet52MultiBlockChange p_72496_1_) {
   int var2 = p_72496_1_.field_73452_a * 16;
   int var3 = p_72496_1_.field_73450_b * 16;
   if(p_72496_1_.field_73451_c != null) {
      DataInputStream var4 = new DataInputStream(new ByteArrayInputStream(p_72496_1_.field_73451_c));

      try {
         for(int var5 = 0; var5 < p_72496_1_.field_73448_d; ++var5) {
            short var6 = var4.readShort();
            short var7 = var4.readShort();
            int var8 = var7 >> 4 & 4095;
            int var9 = var7 & 15;
            int var10 = var6 >> 12 & 15;
            int var11 = var6 >> 8 & 15;
            int var12 = var6 & 255;
            this.field_72564_i.func_73023_g(var10 + var2, var12, var11 + var3, var8, var9);
         }
      } catch (IOException var13) {
         ;
      }

   }
}
项目:RuneCraftery    文件:NetClientHandler.java   
public void handleMultiBlockChange(Packet52MultiBlockChange par1Packet52MultiBlockChange)
{
    int i = par1Packet52MultiBlockChange.xPosition * 16;
    int j = par1Packet52MultiBlockChange.zPosition * 16;

    if (par1Packet52MultiBlockChange.metadataArray != null)
    {
        DataInputStream datainputstream = new DataInputStream(new ByteArrayInputStream(par1Packet52MultiBlockChange.metadataArray));

        try
        {
            for (int k = 0; k < par1Packet52MultiBlockChange.size; ++k)
            {
                short short1 = datainputstream.readShort();
                short short2 = datainputstream.readShort();
                int l = short2 >> 4 & 4095;
                int i1 = short2 & 15;
                int j1 = short1 >> 12 & 15;
                int k1 = short1 >> 8 & 15;
                int l1 = short1 & 255;
                this.worldClient.setBlockAndMetadataAndInvalidate(j1 + i, l1, k1 + j, l, i1);
            }
        }
        catch (IOException ioexception)
        {
            ;
        }
    }
}
项目:BetterNutritionMod    文件:NetClientHandler.java   
public void handleMultiBlockChange(Packet52MultiBlockChange par1Packet52MultiBlockChange)
{
    int i = par1Packet52MultiBlockChange.xPosition * 16;
    int j = par1Packet52MultiBlockChange.zPosition * 16;

    if (par1Packet52MultiBlockChange.metadataArray != null)
    {
        DataInputStream datainputstream = new DataInputStream(new ByteArrayInputStream(par1Packet52MultiBlockChange.metadataArray));

        try
        {
            for (int k = 0; k < par1Packet52MultiBlockChange.size; ++k)
            {
                short short1 = datainputstream.readShort();
                short short2 = datainputstream.readShort();
                int l = short2 >> 4 & 4095;
                int i1 = short2 & 15;
                int j1 = short1 >> 12 & 15;
                int k1 = short1 >> 8 & 15;
                int l1 = short1 & 255;
                this.worldClient.setBlockAndMetadataAndInvalidate(j1 + i, l1, k1 + j, l, i1);
            }
        }
        catch (IOException ioexception)
        {
            ;
        }
    }
}
项目:forge_world_downloader    文件:WDLNetClientHandler.java   
@Override
public void handleMultiBlockChange(Packet52MultiBlockChange par1Packet52MultiBlockChange)
{
    nch.handleMultiBlockChange(par1Packet52MultiBlockChange);       
}
项目:RuneCraftery    文件:NetHandler.java   
public void func_72496_a(Packet52MultiBlockChange p_72496_1_) {
   this.func_72509_a(p_72496_1_);
}
项目: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;
    }
}