Ejemplo n.º 1
0
 public virtual void HandleBlockDig(net.minecraft.src.Packet14BlockDig packet14blockdig)
 {
     RegisterPacket(packet14blockdig);
 }
Ejemplo n.º 2
0
        public override void HandleBlockDig(net.minecraft.src.Packet14BlockDig packet14blockdig)
        {
            if (playerEntity.isDead)
            {
                return;                      // CRAFTBUKKIT
            }
            net.minecraft.src.WorldServer worldserver = mcServer.GetWorldServer(playerEntity
                                                                                .dimension);
            if (packet14blockdig.status == 4)
            {
                playerEntity.DropCurrentItem();
                return;
            }
            bool flag = worldserver.weirdIsOpCache = worldserver.worldProvider.worldType != 0 ||
                                                     mcServer.serverConfigurationManager.IsOp(playerEntity.username);
            bool flag1 = false;

            if (packet14blockdig.status == 0)
            {
                flag1 = true;
            }
            if (packet14blockdig.status == 2)
            {
                flag1 = true;
            }
            int i = packet14blockdig.xPosition;
            int j = packet14blockdig.yPosition;
            int k = packet14blockdig.zPosition;

            if (flag1)
            {
                double d  = playerEntity.posX - ((double)i + 0.5D);
                double d1 = playerEntity.posY - ((double)j + 0.5D);
                double d3 = playerEntity.posZ - ((double)k + 0.5D);
                double d5 = d * d + d1 * d1 + d3 * d3;
                if (d5 > 36D)
                {
                    return;
                }
            }
            net.minecraft.src.ChunkCoordinates chunkcoordinates = worldserver.GetSpawnPoint();
            int l  = (int)net.minecraft.src.MathHelper.Abs(i - chunkcoordinates.posX);
            int i1 = (int)net.minecraft.src.MathHelper.Abs(k - chunkcoordinates.posZ);

            if (l > i1)
            {
                i1 = l;
            }
            if (packet14blockdig.status == 0)
            {
                if (i1 > 16 || flag)
                {
                    playerEntity.itemInWorldManager.Func_324_a(i, j, k, packet14blockdig.face);
                }
                else
                {
                    playerEntity.netServerHandler.SendPacket(new net.minecraft.src.Packet53BlockChange
                                                                 (i, j, k, worldserver));
                }
            }
            else
            {
                if (packet14blockdig.status == 2)
                {
                    playerEntity.itemInWorldManager.Func_22045_b(i, j, k);
                    if (worldserver.GetBlockId(i, j, k) != 0)
                    {
                        playerEntity.netServerHandler.SendPacket(new net.minecraft.src.Packet53BlockChange
                                                                     (i, j, k, worldserver));
                    }
                }
                else
                {
                    if (packet14blockdig.status == 3)
                    {
                        double d2 = playerEntity.posX - ((double)i + 0.5D);
                        double d4 = playerEntity.posY - ((double)j + 0.5D);
                        double d6 = playerEntity.posZ - ((double)k + 0.5D);
                        double d7 = d2 * d2 + d4 * d4 + d6 * d6;
                        if (d7 < 256D)
                        {
                            playerEntity.netServerHandler.SendPacket(new net.minecraft.src.Packet53BlockChange
                                                                         (i, j, k, worldserver));
                        }
                    }
                }
            }
            worldserver.weirdIsOpCache = false;
        }